traits.h 886 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include <type_traits>
  3. namespace NYsonPull {
  4. namespace NDetail {
  5. namespace NTraits {
  6. template <typename T, typename U>
  7. using if_signed = typename std::enable_if<
  8. std::is_signed<T>::value,
  9. U>::type;
  10. template <typename T, typename U>
  11. using if_unsigned = typename std::enable_if<
  12. std::is_unsigned<T>::value,
  13. U>::type;
  14. template <typename T>
  15. using to_unsigned = typename std::enable_if<
  16. std::is_signed<T>::value,
  17. typename std::make_unsigned<T>::type>::type;
  18. template <typename T>
  19. using to_signed = typename std::enable_if<
  20. std::is_unsigned<T>::value,
  21. typename std::make_signed<T>::type>::type;
  22. }
  23. } // namespace NDetail
  24. }