@disable assignment of [] literal?

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 27 07:30:25 PDT 2015


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 []
}


More information about the Digitalmars-d-learn mailing list