Collection of C++ snippets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

22 lines
381 B

#include "counting_iterator.hpp"
#include <vector>
#include <iostream>
int main(){
std::vector<int> v{1,3,37,1337,7};
for(auto x : counted(v)){
std::cout << "v[" << x.index << "] = " << x.value << std::endl;
}
for(auto x : counted(v)){
x.value *= x.index;
}
for(auto x : counted(v)){
std::cout << "v[" << x.index << "] = " << x.value << std::endl;
}
return 0;
}