Skip to content

Monthly Archives: March 2019

C++ switch with textual cases

C++ does not allow using string literals as case values in a switch statement. In modern C++ this restriction can be worked around with constexpr hash values.

any_of<c1, …, c2>(v)

This simple C++17 template implements constexpr any_of for matching a value against a list of constants.