Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<vector>
- int main()
- {
- std::vector<int> v1;
- int i;
- while(std::cin>>i)
- {
- v1.push_back(i);
- }
- for(i : v1) //for (int i:v1) works
- std::cout<<i<<"t";
- cout<<std::endl;
- return 0;
- }
- for (auto it = range.begin(), end = range.end(); it != end; ++it) {
- use(*it);
- }
- for (<range-decl>: <range>) { <body> }
- {
- auto&& range = <range>; // keep the range alive!
- auto it = begin(range); // actually, reality is bit more complicated
- auto end = end(range); // actually, reality is a bit more complicated
- for (; begin != end; ++it) {
- <range-decl> = *it; // this is the rewrite causing your issue
- <body>
- }
- }
- for ( declaration : range ) statement;
Add Comment
Please, Sign In to add comment