implicit casting from primitive type

Mariusz Gliwiński alienballance at gmail.com
Mon Aug 29 12:33:13 PDT 2011


Hello,
this will be easy question. I defined attributes, that are taking my custom 
structures as attributes. Then, I'd like to add implicit conversion to this 
structures from primitive types, such as:
<code>
some.attribute = [1, 2, 3];   // i'd like to do that
some.attribute = MyStruct(1, 2, 3); // now it's like that
</code>
opCast can be used only to casting FROM my type, but not TO...
Was that in a book?

Thanks,
Mariusz Gliwiński


More information about the Digitalmars-d-learn mailing list