Re: Retain struct when using alias this and passing using the alias..?

2012-06-25 Thread Kenji Hara
On Sunday, 24 June 2012 at 13:16:53 UTC, simendsjo wrote: import std.exception; import std.traits; struct Ranged(T, T min, T max) { T _value = min; typeof(this) opAssign(V : T)(V value) { enforce(value >= min); enforce(value <= max); _value = value; return

Re: Retain struct when using alias this and passing using the alias..?

2012-06-24 Thread Tobias Pankrath
On Sunday, 24 June 2012 at 13:16:53 UTC, simendsjo wrote: import std.exception; import std.traits; struct Ranged(T, T min, T max) { T _value = min; typeof(this) opAssign(V : T)(V value) { enforce(value >= min); enforce(value <= max); _value = value; return

Retain struct when using alias this and passing using the alias..?

2012-06-24 Thread simendsjo
import std.exception; import std.traits; struct Ranged(T, T min, T max) { T _value = min; typeof(this) opAssign(V : T)(V value) { enforce(value >= min); enforce(value <= max); _value = value; return this; } alias _value this; } void f(int i) {