http://d.puremagic.com/issues/show_bug.cgi?id=7019
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #7 from [email protected] 2012-01-26 13:55:55 PST --- (In reply to comment #0) > Yes, I'm aware that alias this makes it possible to allow implicit > conversions, > but it can't solve everything, esp. if you need to modify the value before you > 'save' it: > ... Why not aliasing this to set/get methods, e.g: struct Foo(T) { alias prop this; this( in T value ) { m_Prop = value; } @property: T prop() const { return m_Prop; } ref auto prop( in T value ) { return(m_Prop = value, this); } private: T m_Prop; } void bar(T)( in Foo!T foo ) { writeln( cast(T)foo ); } int main() { Foo!int foo = 42; bar( foo ); foo = 10; bar( foo ); return 0; } Are there any problems I'm not aware of? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
