c++ - Alternative for std::set without memory reallocation? -
in application generate lot of subproblems exhaustively , solve them using "std::set" operations. need " insert " , " find " elements , " iterate " on sorted list. the problem each of millions of subproblems "std::set" implementation allocates new memory each time insert element in set makes whole application slow: { // allocate non-value node _nodeptr _pnode = this->_getal().allocate(1); // <- bottleneck of program is there stl-structure allows me to above operations in "o(log(n))" while not reallocating memory? using custom allocator seems way reduce amount of time spent building , releasing std::set<...> . below complete demo of simple allocator program profiling resulting times. #include <algorithm> #include <chrono> #include <cstdlib> #include <iostream> #include <iterator> #include <memory> #include <set> #include <vector> // --------...