On Sun, 28 Dec 2014 14:07:18 -0800 AuoroP via Digitalmars-d-learn <[email protected]> wrote:
let me give you a riddle:
struct ExampleTemplate(T) {
T value;
auto opAdd (typeof(this) that) inout {
import std.traits : Unqual;
Unqual!(typeof(this)) result;
result.value = this.value+that.value;
return result;
}
}
alias ExampleTemplate!int Example;
void main () {
immutable immutableEx = Example(1);
Example ex = Example(1);
Example ex2 = immutableEx+ex;
}
i tend to give some explanations to my answers here, but i'm in a
strange mood today, so sorry, no explanations this time.
signature.asc
Description: PGP signature
