P
puzzlecracker
I have this problem:
I read string identifiers from the file, and based on identifier I
want to invoke certain function. So, in theory, I need something
like enum that supports strings, and then do switch that...Here is a
rough draft of what it should be:
class Value{
private std::string identifier; //read from the file
};
In code
void SomeFunction()
{
switch (VAlue.identifier)
{
case A: // do something, break
case A: // do something, break
case default: report an error error
}
}
what is the common design for this sort of a problem?
I read string identifiers from the file, and based on identifier I
want to invoke certain function. So, in theory, I need something
like enum that supports strings, and then do switch that...Here is a
rough draft of what it should be:
class Value{
private std::string identifier; //read from the file
};
In code
void SomeFunction()
{
switch (VAlue.identifier)
{
case A: // do something, break
case A: // do something, break
case default: report an error error
}
}
what is the common design for this sort of a problem?