Struct toString works but not std.conv.to!string
    Nordlöw via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Oct 13 15:28:57 PDT 2015
    
    
  
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 moving that @property: 
> to after toString and see if that fixes your problem. But given 
> the error, my guess is that the problem relates to the fact 
> that you templatized the constructor, which is often 
> problematic, and whatever type introspection std.conv.to is 
> doing could be choking on that. So, you should probably try 
> making it so that the constructor isn't templatized and see if 
> that fixes the problem.
>
> - Jonathan M Davis
None of you advice helped.
Fortunately I found a solution:
If I move
     import std.conv : to;
into the function scopes
the problem goes away.
Thanks, anyway, for you time.
    
    
More information about the Digitalmars-d-learn
mailing list