3 ms·
Vector and possibly string have that. The vast majority of STL structures do not.
by gibsjose 11y ago
Vector and possibly string have that. The vast majority of STL structures do not.
- catnaroek 11y agoAll containers from the C++ standard library (please don't call it STL, that's Stepanov's original library) can be parameterized by an allocator. You can use whatever allocation policy you like best. However, most people use the default allocator because it's good enough. In any case, while C++ has lots of defects, “loss of control relative to what C gives you” isn't one of them.
- gibsjose 11y agoYeah, that's true.
- optforfon 11y ago(a bit of topic - but I'm humbly trying to learn more...) I've got zero experience writing allocators. Is there some common ones you use provided somewhere? Do you write your own? (in which case can you point me to where to learn to do that properly)
- catnaroek 11y agoI don't write allocators myself, but Boost has a pool allocator library [http://www.boost.org/doc/libs/1_60_0/libs/pool/doc/html/index.html http://www.boost.org/doc/libs/1_60_0/libs/pool/doc/html/inde...], which conforms to the Allocator concept defined in the standard library [http://en.cppreference.com/w/cpp/concept/Allocator http://en.cppreference.com/w/cpp/concept/Allocator].
- optforfon 11y agoThank you