Macro ENSURE() from KBase can ‘capture’ variables by outputing their content to the internal stringtream, provided the type of captured variables has overloaded operator<<().
However, for variables of enum-class types, which disallow implicit conversion to underlying integer, there is no easy way to enable ENSURE() to capture them, because every enum-class is a type, and it is not realistic to define an overloaded operator<<() for each of them.
We need to handle all enum-class types as a category.
std::is_enum<T> can identify a type if it is an enum at compile-time (it is one of type-traits utils), and in conjunction with some SFINAE tricks, we can categorize types at compile-time and handle them with different policies.