Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> which is done using an allocator, and which essentially cannot be implemented in terms of new

Actually the standard says std::allocator<T> just calls the global operator new function[0]. When you call construct(), placement-new is then used to construct the objects in place. This makes it easy to replace the memory allocator globally as well as on a per-container basis.

[0] http://en.cppreference.com/w/cpp/memory/new/operator_new



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: