Advertisement
Guest User

Untitled

a guest
Apr 28th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class Object
  2. {
  3. Object(const Object&) = delete;
  4. Object(Object&&);
  5. Object& operator=(const Object&) = delete;
  6. Object& operator=(Object&&);
  7. [...]
  8. };
  9.  
  10. std::vector<Object> container;
  11.  
  12. container.reserve(42) // Reserve a lot in order to be sure it won't be a problem
  13.  
  14. container.emplace_back(1);
  15. container.emplace_back(3);
  16.  
  17. auto it = container.end();
  18.  
  19. it--; // Last position.
  20. it--; // Before last position.
  21. container.emplace(it, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement