Quantcast
Channel: User rmn - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by rmn for Evaluate a string with a switch in C++

$
0
0

You can only use switch-case on types castable to an int.

You could, however, define a std::map<std::string, std::function> dispatcher and use it like dispatcher[str]() to achieve same effect.


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>