How do I find the largest int in a std::set<int> ?
I have a std::set, what's the proper way to find the largest int in this set ? ...
I have a std::set, what's the proper way to find the largest int in this set ? ...
I've a question about the thread safety of std::set. As far as I know I can iterate over a set and add/erase members and that doesn't invalidate the iterators. But consider following scenario: thread 'A' iterates over a set of shared_ptr<Type> thread 'B' occasionally adds items to this set. I've experienced segfaults as the program...
I have recently caught the following crash in my application: m_players[0].erase(plr); -- CRASHES HERE m_players[1].erase(plr); m_players is declared as: set<PlayerPointer> m_players[2]; Visual Studio shows that it is "0xC0000005: Access violation writing location 0x0000000000000024." Compiler: Visual Studio 2008. Diassembly: 00...
I need to keep track of std::set element by saving the iterator returned by set.find(). My questions is does insertion and removing other elements invalidates the obtained iterator? From a simple test I did I can see it is not, but I'd like to ensure this feature is by design. ...