Advertisement
WeltEnSTurm

C++0x Awesomeness V1

Aug 13th, 2011
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1.  
  2. std::vector<std::string> stuff;
  3. stuff.push_back("This is not awesome.");
  4. stuff.push_back("Totally not.");
  5. for(std::vector<std::string>::iterator it = stuff.begin(); it != stuff.end(); it++)
  6.     print(stuff[i]);
  7.  
  8.  
  9. // Two variants for C++0x:
  10.  
  11. std::vector<std::string> stuff = {
  12.     "This is awesome.",
  13.     "Totally."
  14. }
  15. for(std::string& v : stuff) // sadly not implemented yet in most compilers
  16.     print(v)
  17.    
  18. for(auto it = stuff.begin(); it != stuff.end(); it++)
  19.     print(v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement