Advertisement
kalabukdima

references

Jan 16th, 2018
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. std::vector<std::pair<int, std::vector<int>>> a;
  2. // ...
  3.  
  4. // Bad
  5. if (!a.back().second.empty()) {
  6.     a.back().second.pop_back();
  7. }
  8.  
  9. // Better, C++98
  10. std::vector<int>& last = a.back().second;
  11. if (!last.empty()) {
  12.     last.pop_back();
  13. }
  14.  
  15. // Better, C++11
  16. auto& last = a.back().second;
  17. if (!last.empty()) {
  18.     last.pop_back();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement