struct template help
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 12 12:42:12 PDT 2014
On 07/12/2014 12:38 PM, Danyal Zia wrote:
> You can initialize in constructor this(), but you can't initialize
> partial fields of struct when using pointer to struct.
Actually, that works too but members must be initialized from the
beginning. The trailing ones are left with .init values:
struct S
{
int i;
string s;
}
void main()
{
auto s = new S(42);
static assert(is (typeof(s) == S*));
}
Ali
More information about the Digitalmars-d-learn
mailing list