Bug 24049 – std.conv.to: string to enum conversion is not documented

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-07-19T00:22:17Z
Last change time
2023-07-24T08:22:00Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2023-07-19T00:22:17Z
std.conv.to supports conversion between enum types and string in both directions: --- import std.conv: to; enum Example { foo } unittest { assert(Example.foo.to!string == "foo"); assert("foo".to!Example == Example.foo); } --- However, only the enum-to-string conversion is mentioned in std.conv.to's documentation: > Stringize conversion from all types is supported. > [...] > * Enumerated types are converted to strings as their symbolic names. The conversion in the other direction, from string to enum type, is only mentioned in the documentation for std.conv.parse, where users of std.conv.to are likely to miss it.
Comment #1 by dlang-bot — 2023-07-21T17:25:54Z
@dkorpel created dlang/phobos pull request #8784 "Fix 24049 - std.conv.to: string to enum conversion is not documented" fixing this issue: - Fix 24049 - std.conv.to: string to enum conversion is not documented https://github.com/dlang/phobos/pull/8784
Comment #2 by dlang-bot — 2023-07-24T08:22:00Z
dlang/phobos pull request #8784 "Fix 24049 - std.conv.to: string to enum conversion is not documented" was merged into master: - fd266d7e895a5978a4d32f86af48b73b4e19ba4a by Dennis Korpel: Fix 24049 - std.conv.to: string to enum conversion is not documented https://github.com/dlang/phobos/pull/8784