casting to structure
Igor Shirkalin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 24 14:11:13 PDT 2017
On Saturday, 24 June 2017 at 20:43:48 UTC, Igor Shirkalin wrote:
> struct A
> {
> void * data; // void * type is just for example
> // no matter what is here
> }
I know that if I add constructor this(int)
struct A {
void * p;
this(int k) { p = cast(void*)k; }
}
auto a = cast(A) 23; // it works
Is it possible without such a constructor?
More information about the Digitalmars-d-learn
mailing list