[Issue 9286] std.conv.parse fails to compile with Nullable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 9 03:32:05 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9286


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-01-09 03:32:01 PST ---
std.traits is purposefully _not_ taking implict conversion into account (doing
otherwise would cause havoc with template constraints), and isIntegral
specifically says "Detect whether $(D T) is a built-in integral type." And it's
not like isIntegral could be made to work for user-defined types, as integral
types don't have an API specific to themselves. The trait has to know all of
the types that count as being integral types.

To do the conversion that you're looking for, just convert to uint first:

    auto f = to!(Nullable!uint)(to!uint("12"));

or

    auto f = Nullable!uint(to!uint("12"));

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list