From: David Abrahams (dave_at_[hidden])
Date: 2007-07-01 21:13:34
on Tue Jun 19 2007, Tobias Schwinger <tschwinger-AT-isonews2.com> wrote:
> 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.
You have generic algorithms that expect to get ownership of a
> 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
>> 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.
Just that you might want to support the general case and build the
others on top... if possible.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk