[C++-sig] make_constructor issues

Stefan Seefeld seefeld at sympatico.ca
Sat Jul 24 01:23:19 CEST 2004


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. I can certainly live with
the status quo (but I'd suggest documenting the constraint somewhere).

Regards,
		Stefan




More information about the Cplusplus-sig mailing list