admin管理员组

文章数量:1122832

I've written several memory allocator that couldn't allow the allocation of more than 1 unit of the specified type T, as apparently required by the Standard C++ library's collections that take allocator's.

Is there any official limit on which collections might ask for more than 1 unit, and under what conditions?

Failing that, is there any practical advice, basically for Windows and Linux, not for what is promised, but at least for what can be expected in the real world?

In principle that I could add low-performance code that supports such allocations, if I have no other choice, while hoping that the compiler would optimize away checks for allocation count due to the container calling it with a hard-coded "1". I'm also thinking I should check the code and see what the current containers do, but my interest is a little broader than that: I'd like to make code likely to work going forward, or in past releases of STL, and so on.

本文标签: stlC custom allocators in what circumstances would I be asked to return more than 1 unitStack Overflow