Advertisement
Radfler

::underlying_type

Jun 13th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <type_traits>
  2.  
  3. namespace details {
  4.  
  5.   template<typename Type, bool IsEnum = std::is_enum<Type>::value>
  6.   struct underlying_type : std::underlying_type<Type> { };
  7.  
  8.   template<typename Type>
  9.   struct underlying_type<Type, false> { };
  10.  
  11. }
  12.  
  13. template<typename Type>
  14. struct underlying_type : details::underlying_type<Type> { };
  15.  
  16. template<typename Type>
  17. using underlying_type_t = typename underlying_type<Type>::type;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement