Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-08-08 16:51:10


On 08/08/2004 09:59 AM, Dave Harris wrote:
[snip]
> Is it time to wrap operator new()? For example:
>
> boost::shared_ptr<Widget> wp2 = boost::make<Widget>(a, b);
>
> with something like:
>
> template <typename R, typename A, typename B>
> inline raw_ptr_t<R> make( A &a, B &b ) {
> return raw_ptr_t<R>( new R( a, b ) );
> }
>
> Users being allowed to specialise make<> with their own factory code if
> desired.

At first glance and except for:

   1) terseness
   2) limitation to 2 arguments
   3) the need for separate allocation for the overhead

I can't see much difference between the above make<R,A,B> and
auto_overhead at:

http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/managed_ptr/auto_overhead.hpp?rev=1.2&view=auto

AFAICT, it would be a simple change to just skip the overhead allocation
by making the overhead in auto_overhead an empty base class.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk