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.
版权声明:本文标题:stl - C++ custom allocators: in what circumstances would I be asked to return more than 1 unit? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736304054a1932098.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论