[C++-sig] Re: make_constructor issues

David Abrahams dave at boost-consulting.com
Sat Jul 24 16:34:29 CEST 2004


Stefan Seefeld <seefeld at sympatico.ca> writes:

> Ralf W. Grosse-Kunstleve wrote:
>> --- Stefan Seefeld <sseefeld at art.ca> wrote:
>> 
>>>>To me it seems the best implementation of the factory should return
>>>>auto_ptr<Foo> or shared_ptr<Foo> in order to avoid a copy.
>>>
>>>But copy-construct it must anyways, simply because I chose to export
>>>the type as class_<Foo>, not class_<Foo, shared_ptr<Foo> > !?!
>> Probably, but the point is that the current make_constructor
>> implementation
>> covers the general case. Is it really worth the complication of implementing
>> another make_constructor overload? As shown in one of my previous messages you
>> can very easily modify your original factory function to fit into the current
>> system.
>
> yes, it's not a problem. As I said, I was just surprised to see it not working,
> since most (all ?) other functions easily deal with derived types. I have no
> idea how much complication a generalization involves. 

What do derived types have to do with anything?

> I can certainly live with the status quo (but I'd suggest
> documenting the constraint somewhere).

If someone would like to write the doc file make_constructor.html and
remove the completely erroneous docs for make_constructor from
make_function.html, I'd be most grateful.  Otherwise, I'll try to get
to it, but I'm officially on vacation.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list