fork(5) download
  1. #include <boost/range/adaptor/indexed.hpp>
  2. #include <vector>
  3. #include <string>
  4. #include <iostream>
  5.  
  6. std::vector<std::string> strings{10, "Hello"};
  7. int main(){
  8. strings[5] = "World";
  9. for(auto const& el: strings| boost::adaptors::indexed(0))
  10. {
  11. std::cout << el.index() << ": " << el.value() << std::endl;
  12. }
  13. }
Success #stdin #stdout 0s 4476KB
stdin
Standard input is empty
stdout
0: Hello
1: Hello
2: Hello
3: Hello
4: Hello
5: World
6: Hello
7: Hello
8: Hello
9: Hello