[Issue 9821] Smarter conversion of strings to enums

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 26 18:23:33 PDT 2013


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


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

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


--- Comment #6 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-03-26 18:23:30 PDT ---
> But there should be at least some alternative function for converting strings
to enums using the base type

Then just use to with the base type. And if you're dealing with generic code or
don't want to hard code what the base type is, then use
std.traits.OriginalType:

to!(OriginalType!MyEnum)(str);

-- 
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