Guest User

Untitled

a guest
Jul 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <forward_list>
  2.  
  3. int main (){
  4. std::forward_list< std::pair<int,char> > mylist;
  5.  
  6. auto it = mylist.before_begin();
  7.  
  8. it = mylist.emplace_after ( it, 100, 'x' );
  9. it = mylist.emplace_after ( it, 200, 'y' );
  10. it = mylist.emplace_after ( it, 300, 'z' );
  11.  
  12. std::cout << "mylist contains:";
  13. for (auto& x : mylist)
  14. std::cout << " (" << x.first << "," << x.second << ")";
  15.  
  16. std::cout << 'n';
  17. return 0;
  18. }
Add Comment
Please, Sign In to add comment