Re: Struct toString works but not std.conv.to!string

2015-10-13 Thread anonymous via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 22:21:43 UTC, Ali Çehreli wrote: Reduced with a workaround: struct UTCOffset { import std.conv : to;// Move to module scope to compile This introduces UTCOffset.to as an alias to std.conv.to. string toString() const { return "hello";

Re: Struct toString works but not std.conv.to!string

2015-10-13 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 21:50:54 UTC, Jonathan M Davis wrote: Just glancing at your code, you've marked toString with @property, which is kind of a weird thing to do, nd if we ever make @property enforce that it's not called with parens, then that code won't work. So, you might try movin

Re: Struct toString works but not std.conv.to!string

2015-10-13 Thread Ali Çehreli via Digitalmars-d-learn
On 10/13/2015 02:07 PM, Nordlöw wrote: I have defined a struct UTCOffset in https://github.com/nordlow/justd/blob/master/datetime_ex.d Everything works as desired except for import std.conv : to; assert(UTCOffset(+14, 0).to!string == "UTC+14:00"); which fails as /usr/include/dmd/ph

Re: Struct toString works but not std.conv.to!string

2015-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 13, 2015 21:07:07 Nordlöw via Digitalmars-d-learn wrote: > I have defined a struct UTCOffset in > > https://github.com/nordlow/justd/blob/master/datetime_ex.d > > Everything works as desired except for > > import std.conv : to; > assert(UTCOffset(+14, 0).to!string == "