Special Type Challenge
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 6 19:48:23 PST 2015
On Saturday, 7 February 2015 at 01:55:27 UTC, Jonathan Marler
wrote:
> b = -256;
that won't fit in a byte btw.
The rest of the assignment stuff is easy. I'd prolly even do it
with a template:
this(T)(T t) { this.opAssign(t); } // for construction
Byte opAssign(T)(T t) if(T.sizeof == 1) { // for other assignment
data_holder = cast(typeof(data_holder) t);
}
and that should do it.
> Byte[] barr;
>
> barr = "teststring";
> barr = [0,1,2,3];
> }
Language won't let you do these though.
More information about the Digitalmars-d
mailing list