No constructor for a templated class?
Philippe Sigaud
philippe.sigaud at gmail.com
Mon Jul 26 05:59:23 PDT 2010
On Mon, Jul 26, 2010 at 13:15, Jacob Carlborg <doob at me.com> wrote:
> Perhaps a factory function like opCall or something similar ?
>
> class Foo
> {
> int x;
>
> static Foo opCall (T) (T y)
> {
> Foo foo = new Foo;
> foo.x = y;
> return foo;
> }
> }
>
> auto foo = Foo(3);
>
>
Ah yes, I forgot about static opCall. Thanks Jacob, I'll try this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100726/bd322345/attachment.html>
More information about the Digitalmars-d-learn
mailing list