Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-06-19 07:06:44


David Abrahams wrote:
> on Sun Jun 17 2007, Tobias Schwinger <tschwinger-AT-isonews2.com> wrote:
>> Interface draft:
>> ================
>>
>> factory<T> // constructs X and returns it by value
>> factory<T*> // uses operator new, returns a pointer
>
> auto_ptr, please.

Generic algorithms won't 'get' it.

In this light, it seems better to have a separate template for pointers,
so you clients can specify what they want, explicitly:

     new_< T* >
     new_< auto_ptr<T> >
     new_< special_smartie<T> >

(Seems tricky to deduce T but it might be doable).

>> Where operator() takes a variable number of arguments, forwarded to the
>> constructor.
>
>
> Isn't in-place construction the most general case?

It sure is, but not necessarily the most handy. How to tell e.g.
std::transform to allocate memory for the transformed elements?

Not sure I really got your point, here.

Regards,
Tobias


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