I have an enum like this
enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun};
I am trying to get the index value of the enum by passing a string value.
For example, GetenumIndex("Mon")
will return 0
.
The prototype of the function is like:
week GetenumIndex(string )
What is the idiomatic way in C++ to implement such a conversion function?