Created
December 8, 2012 14:12
-
-
Save lvv/4240393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
// 0 1 2 3 4 5 6 7 8 9 | |
// is lazy, works with STL algorighms | |
auto NR = range(1,999999999999999999l); | |
cout << *find(NR.begin(), NR.end(), 5) << endl; | |
// 5 | |
// any arithmetic type | |
for (auto x : range(0,1,0.2)) cout << x << " "; cout << endl; | |
// 0 0.2 0.4 0.6 0.8 1 | |
for (char c : range('a','z')) cout << c << " "; cout << endl; | |
// a b c d e f g h i j k l m n o p q r s t u v w x y z | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment