--- "E. Gladyshev" <[EMAIL PROTECTED]> wrote: > > --- David Abrahams <[EMAIL PROTECTED]> wrote: > > >>> But indeed allocate/construct/deallocate/destroy is more work than > > >> ^^^^^^^^^ ^^^^^^^ > > >> Oyeah. These two absolutely don't belong in allocator, period. Do > > >> any implementations even use them? Allocators exist to provide a > > >> point of customization for users, but you cannot/should not customize > > >> these. > [...] > > The class getting constructed/destroyed has full control over that or > > the language is utterly bustificated. > > I think construct/destroy can be implemented as non-customizable > static functions in boost just for convinence. > > static template< typename A > > typename A::pointer construct( A& a, size_t n ) > { > typename A::pointer p = a.allocate(n) > try > { > p = new(p) A::value_type[n]; > } > catch(...) > { > a.deallocate( p, n ); > } > return p; > } > > Eugene
Oops, static template< typename A > typename A::pointer construct( A& a, size_t n ) { [...] catch(...) { a.deallocate( p, n ); throw; } return p; } Eugene __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost