Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rowanj
Created June 27, 2012 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanj/3004098 to your computer and use it in GitHub Desktop.
Save rowanj/3004098 to your computer and use it in GitHub Desktop.
Using multiple Boost pools with a class heirarchy
struct Base{virtual ~Base(){}; int x;};
struct Derived : public Base {int y;};
#import <boost/pool/object_pool.hpp>
namespace pools
{
boost::object_pool<Base> Base;
boost::object_pool<Derived> Derived;
}
int main()
{
Base* b = pools::Base.construct();
Base* d = pools::Derived.construct();
Derived* d_ = dynamic_cast<Derived*>(d);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment