To select based on a string you have to use an if-statement or a map A switch-statement generates optimized code for comparing against a set of constants. For larger sets of constants, this typically yields more efficient code than a collection of if-statements.
Cpp
my conspect of the Stroustrup C++ book. + additional C++ topics.