Bug 2985 – Add enumToString and enumFromString to std.conv

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2009-05-15T15:37:00Z
Last change time
2015-06-09T01:26:25Z
Keywords
patch
Assigned to
andrei
Creator
rsinfu

Attachments

IDFilenameSummaryContent-TypeSize
368stdconv_enum.patchAdds enumToString and enumFromStringtext/plain3977

Comments

Comment #0 by rsinfu — 2009-05-15T15:37:42Z
Created attachment 368 Adds enumToString and enumFromString The patch adds new template functions enumToString and enumFromString to std.conv. These functions convert between an enum member value and its name, and do not require that enums should be defined by some template (cf. defineEnum).
Comment #1 by andrei — 2009-05-16T05:08:13Z
Looks great! I'll add the functions and credit for you in std.conv. Thank you, Shin!
Comment #2 by andrei — 2009-07-03T21:14:21Z
I just merged Shin's implementation to std.conv and added his name to the list of authors for the module. Instead of adding enumToString and enumFromString, I had Shin's code replace the corresponding "to" functions directly. The feature will be part of the next release.