[C++-sig] Re: Injected constructors
nicodemus at globalite.com.br
Thu Jul 24 17:02:11 CEST 2003
David Abrahams wrote:
>"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:
>>--- David Abrahams <dave at boost-consulting.com> wrote:
>>>>Another idea: could we expand the init<> interface so that it would
>>>>accept an optional factory function, allowing the user to write:
>>>I thought of that; do you think it would be confusing because of the
>>I like this best if it is a possibility.
>I resisted it for a long time I guess it is a real possibility. I was
>going to say that it imposes a small overhead for:
>because that init object needs to include refcount management for a
>possible factory. If you don't like that overhead, though, you can
>just let class_<X>("X") give you a default init function without the
>Nobody thinks it's a case of trying to pack too much functionality
>into one object? If not, so much the better.
Yeah, I agree with Ralf, since it is similar with the current way to
export constructors. And I don't think that it's the case of trying to
pack too much functionality, since the purpose of init<> is to export
constructors... the factory overload would be just another method to
accomplish the same thing.
More information about the Cplusplus-sig