@disable assignment of [] literal?

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 27 09:32:06 PDT 2015


On Monday, 27 April 2015 at 14:30:26 UTC, Kagamin wrote:
> Use a different type to match empty slice instead of void[]?
>
> struct ArrayWrapper(T)
> {
>     T t;
> 	
>     this(T t)
>     {
>         assert(t !is null);
>     }
>
>     @disable this(typeof(null));
>     @disable this(ArrayWrapper[]); //should match []
> 	
>     typeof(this) opAssign(T val)
>     {
>         assert(t !is null);
>         this.t = val;
>
>         return this;
>     }
> 	
>     @disable typeof(this) opAssign(typeof(null));
>     @disable typeof(this) opAssign(ArrayWrapper[]); //should 
> match []
> }

That won't work because I want to catch the [] literal, which is 
of type void[] and not ArrayWrapper[].


More information about the Digitalmars-d-learn mailing list