Extensions to types loaded from a C library

Jacob Carlborg doob at me.com
Fri Dec 14 04:52:39 PST 2012


On 2012-12-14 13:36, Mike Parker wrote:

> Obviously, this technique won't work for constructors, but it should
> work for most any other method you'd like to add. And I don't see a need
> to add a constructor anyway except in very specific circumstances (i.e.
> you want a constructor with fewer or more params, or different types,
> than the number or type of struct fields). And even then it's only a
> convenience.

No need for a constructor if you want fewer arguments:

struct Foo
{
     int a;
     int b;
}

auto f = Foo(3);

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list