Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-03-29 08:59:22

On 03/29/2006 07:12 AM, David Abrahams wrote:
> Václav Veselý <vaclav.vesely_at_[hidden]> writes:
>>How this is related to auto_overhead?
> I have no idea. Nobody ever explained auto_overhead to me in a way
> that I could understand.
It's the class template version of your function template, new_.
IOW, it's something like:

   template<class T>
   struct auto_new
     : private std::auto_ptr<T>
       typedef std::auto_ptr<T> super_type;
       template< BOOST_PP_ENUM_PARAMS_Z(1, NEW_arity, class A) >
       auto_new( BOOST_FORWARD_ENUM_BINARY_PARAM_SEQ_R(1, NEW_constness,
A, x) )
         : super_type(new T(BOOST_PP_ENUM_PARAMS_Z(1, NEW_arity, x)))
       T* get(void) { return super_type::get();}

(I may have misplaced a '(' or ',' or two. I hope you can see what
I meant).

Note there's no T* in any CTOR arguments (unless, of course, there's
some T CTOR taking a T*).

Also note, there's no Overhead<T> as there is in auto_overhead, but
that's just another feature (designed to save the extra allocation
needed shared_ptr) and wouldn't be relevant to this discussion, AFAICT.

Is auto_overhead still unclear?

Boost list run by bdawes at, gregod at, cpdaniel at, john at