Re: What's the rationale here? alias this and function arguments

2015-03-10 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 10 March 2015 at 10:36:21 UTC, ketmar wrote: On Tue, 10 Mar 2015 10:27:13 +, John Colvin wrote: struct S { int a; this(T)(T v) { this = v; } void foo(T)(T v) { import std.conv : to; a =

What's the rationale here? alias this and function arguments

2015-03-10 Thread John Colvin via Digitalmars-d-learn
struct S { int a; this(T)(T v) { this = v; } void foo(T)(T v) { import std.conv : to; a = v.to!int; } alias foo this; } void bar(S s){} void main() { S s0; s0 = 3;

Re: What's the rationale here? alias this and function arguments

2015-03-10 Thread ketmar via Digitalmars-d-learn
On Tue, 10 Mar 2015 10:27:13 +, John Colvin wrote: struct S { int a; this(T)(T v) { this = v; } void foo(T)(T v) { import std.conv : to; a = v.to!int; } alias foo this; } void bar(S s){} void

Re: What's the rationale here? alias this and function arguments

2015-03-10 Thread Baz via Digitalmars-d-learn
On Tuesday, 10 March 2015 at 10:27:14 UTC, John Colvin wrote: struct S { int a; this(T)(T v) { this = v; } void foo(T)(T v) { import std.conv : to; a = v.to!int; } alias foo this; }