Struct constructor, opCall mess.
Tobias Pankrath
tobias at pankrath.net
Mon Feb 24 06:14:42 PST 2014
On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote:
> Hi,
>
> right now I am truing to figure out how the constructors behave
> in D2.
>
> Question 1: why it is not possible to create custom ctor for
> struct?
The design of D relies on the fact that every type has a T.init
property that is known to the compiler and used when in C++ the
default ctor would get called. In constructors you can rely on
(this == T.init), for example.
You need to pick one T.init or default constructors and D picked
T.init.
More information about the Digitalmars-d-learn
mailing list