Is there a simple way in C++ to convert a string to an enum (similar to Enum.Parse
in C#)? A switch statement would be very long, so I was wondering i
"Additional question: Is it possibile to handle undefined strings ? I mean if I try to get the value for responseHeaderMap["cookie"], what will be the value? (provided that "cookie" is not defined in the responseHeaderMap – bart s Nov 22 '16 at 12:04"
well, you can just make check before:
auto it = responseHeaderMap.find("cookie");
if (it != responseHeaderMap.end())
{
// "cookie" exist, can take value
}
After "cookie" exist check, you can get it value with use:
responseHeaderMap["cookie"]
hope this help