Skip to content

Instantly share code, notes, and snippets.

@rowanj

rowanj/gist:3004098

Created Jun 27, 2012
Embed
What would you like to do?
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