You are here: My Account > Point one > Count three
Headline news
Advertisement
 

Projects / AuxUtils Cpp / Snippets

The project AuxUtils is an auxiliary C++ library that implements the missing functionality from the Boost libraries. The library provides some efficient functions and templates and wraps some platforms dependent functions.
PrevUpHomeNext

Snippet: Object pool usage

This snippet illustrates how to use object pool. Objects pool shares the object instances for more efficiently using memory management. Objects instance in pool are never recreated.

// Creation a pool. Maximum of instances in the pool is 1000 and initially will be created is 5.
auxutils::ept::ObjectPool* poPool = new auxutils::ept::ObjectPool ( 1000, 5 );

// Get an instance from pool
MyClass* poInstance = poPool->getObject();

// Return the instance to pool
poPool->returnObject(poInstance);

// Delete pool
delete poPool;
PrevUpHomeNext