On Friday, July 24, 2015 01:30:55 Enjoys Math via Digitalmars-d-learn wrote: > Here's my code: > > module grammar; > > class Grammar(T : ulong) { > this(const T[] str) { > auto grammar = str in grammarCache; > > if (grammar) { > this = grammar.dup; > } else { > this = approximateSmallestGrammar(str); > grammarCache[str] = this.dup; > } > } > > static Grammar approximateSmallestGrammar(const T[] str) { > return new Grammar(); > } > > @property Grammar dup() { > > } > > private: > this() {} > static Grammar[T[]] grammarCache; > }; > > > Compiler says 'this' is not an lvalue. How would I accomplish > what I want?
Assign to the members individually rather than the whole object at once. - Jonathan M Davis