----- Original Message ----- From: "E. Gladyshev" <[EMAIL PROTECTED]> > I am wondering what happened to the allocator idiom in > boost. Was it left out intentially? > I can control all memory allocation details in STL > (orthogonally to data types) but not in boost. > It seems like a step backward comparing to STL. > How can I use allocators with shared_ptr? Is there any > way to write something like this. > f() > { > shared_ptr< int, std::allocator<int> > myptr; > myptr.allocate(); > *myptr = 123; > }
shared_ptr<int> myptr(new int(123)); ? The allocator design focused on the benefits one could get from specialized allocators for containers, e.g., data structures that may allocate large chunks of memory that are expected to be used together. They don't really give us much for components like shared_ptr that allocate one thing (and note that shared_ptr does not allocate the pointer it stores, although it does allocate a reference count). boost::function supports an allocator argument, but the C++ committee is considering removing this allocator from the library TR version of function<> for precisely this reason. Doug _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost