Advertisement
tinyevil

Untitled

Nov 11th, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.15 KB | None | 0 0
  1. template<class T>
  2. generator< pair<int, T> > enumerate(generator<T> gen){
  3.     int idx = 0;
  4.     while ( T val = gen() ){
  5.         yield {idx, val};
  6.         idx++;
  7.     }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement