Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. inline std::pair<T,T>& GetPortfolio()
  2. {
  3.     static std::pair<T,T> myPair;
  4.     myPair.first = m_container.begin();
  5.     myPair.second = m_container.end();
  6.     return myPair;
  7. }
  8.  
  9. std::pair<T,T> one = GetPortfolio();
  10.  
  11. //Do some algorithm on m_container
  12.  
  13. std::pair<T,T> two = GetPortfolio();
  14.  
  15. //At this point both one and two hold valid iterators (as both reference static object)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement