www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15554] New: typedef standard type can't be used with to!

https://issues.dlang.org/show_bug.cgi?id=15554

          Issue ID: 15554
           Summary: typedef standard type can't be used with to! properly
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: gruen_tobias web.de

Casting from a string to a custom Typedef type is more complicated than it
should be. To should actually care about the underlying typedef-type, and
recognize that it has to parse a string to a long value:

alias QuestionId = Typedef!(long, long.init, "QuestionId");

QuestionId q = to!(TypedefType!QuestionId)("43"); // Compiles
QuestionId q2 = to!QuestionId("43");              // Error..

Forum:
http://forum.dlang.org/thread/otcbczxfxzannjcoktfz forum.dlang.org


togrue

--
Jan 11