Skip to content

Instantly share code, notes, and snippets.

@lvv
Created December 8, 2012 17:05
Show Gist options
  • Save lvv/4241049 to your computer and use it in GitHub Desktop.
Save lvv/4241049 to your computer and use it in GitHub Desktop.
#include <sto/sto.h>
using namespace sto;
#include <vector>
#include <iostream>
using namespace std;
int main() {
// no need for clumsy iota (is covertable to any STL container)
vector<int> V = range(10);
for (int x:V) cout << x << " "; cout << endl;
// is lazy, works with STL algorighms
auto NR = range(1,999999999999999999l);
cout << *find(NR.begin(), NR.end(), 5) << endl;
// any arithmetic type
for (auto x : range(0,1,0.2)) cout << x << " "; cout << endl;
for (char c : range('a','z')) cout << c << " "; cout << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment