The C++ Type Loophole (C++14) - Alexandr Poltavsky, software developer
The C++ Type Loophole (C++14) Recently I was doing some work on retrieving struct data member types. And as I was exploring, researching and testing ideas I uncovered this pearl: template struct tag{}; template struct loophole_t { friend auto loophole(tag) { return T{}; }; }; auto loophole(tag); sizeof( loophole_t ); std::is_same std::string, decltype( loophole(tag{}) ) ::value;
Source: alexpolt.github.io