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.
22 lines
381 B
22 lines
381 B
14 years ago
|
#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;
|
||
|
}
|