Bypassing const with a union
Era Scarecrow
rtcvb32 at yahoo.com
Fri Jun 1 13:26:59 PDT 2012
On Friday, 1 June 2012 at 20:24:39 UTC, Era Scarecrow wrote:
> //from const, to const
> const(S) opSlice(int s, int e) const {
> S s = this; //compile error this.array is const
> s.array = this[s .. e]; //compile error
> return s;
> }
Correction: Seems this didn't get updated while I was testing
this.
//from const, to const
const(S) opSlice(int s, int e) const {
S sl = this; //compile error this.array is const
sl.array = this[s .. e]; //compile error
return sl;
}
More information about the Digitalmars-d-learn
mailing list