Is there an elegant C ++ implementation for fixed-size distribution?

I think the C ++ library is "elegant" if the number of header files that should be included is as small as possible.

I know that there are existing fixed size distributors, such as Loki::SmallObjectAllocatorand boost::pool. Although both of them are excellent, I think that they are not elegant and are not easily integrated into projects.

In most cases, I need a small part of the boost library, but I need to install the entire library on my machine. For example, if I want to use boost :: pool, I hope to just include the ONE header boost_pool.hand the work will be done. Since I think that a fixed-size distributor should not depend on too many other components. In my opinion, the ideal code should look like this:

#include <boost_pool.h>

int main()
{
   boost::pool<int> p;
   int* v = p.allocate();
}

Does such a library exist?

+5
source share
2 answers

. , . , . ++ 11, ++ 03. ++ 03, .

+4

All Articles