Re: Phobos func for string -> enum member?

2016-10-13 Thread Nick Sabalausky via Digitalmars-d-learn
On 10/13/2016 07:14 PM, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Oct 13, 2016 at 07:11:15PM -0400, Nick Sabalausky via Digitalmars-d-learn wrote: I'm sure it'd be easy enough to write, but does phobos have a simple way to convert the name of an enum member from a runtime string to the

Re: Phobos func for string -> enum member?

2016-10-13 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 13, 2016 at 07:11:15PM -0400, Nick Sabalausky via Digitalmars-d-learn wrote: > I'm sure it'd be easy enough to write, but does phobos have a simple > way to convert the name of an enum member from a runtime string to the > enum type? > > Ie, something like: > > enum Foobar { foo=1,

Re: Phobos func for string -> enum member?

2016-10-13 Thread Ali Çehreli via Digitalmars-d-learn
On 10/13/2016 04:11 PM, Nick Sabalausky wrote: I'm sure it'd be easy enough to write, but does phobos have a simple way to convert the name of an enum member from a runtime string to the enum type? Ie, something like: enum Foobar { foo=1, bar } Foobar a = doesThisExistInPhobos!Foobar("foo");

Phobos func for string -> enum member?

2016-10-13 Thread Nick Sabalausky via Digitalmars-d-learn
I'm sure it'd be easy enough to write, but does phobos have a simple way to convert the name of an enum member from a runtime string to the enum type? Ie, something like: enum Foobar { foo=1, bar } Foobar a = doesThisExistInPhobos!Foobar("foo"); I'm not finding anything like it in the docs,