You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 rivejä
752 B

  1. #pragma once
  2. #include <cstddef>
  3. #include <type_traits>
  4. namespace utl {
  5. namespace mp {
  6. template<typename T>
  7. struct tag_integral_constant { };
  8. template<typename T, T t>
  9. struct integral_constant :
  10. public std::integral_constant<T, t>
  11. {
  12. using tag = tag_integral_constant<T>;
  13. };
  14. template<bool B>
  15. using c_bool_t = integral_constant<bool, B>;
  16. template<size_t S>
  17. using c_size_t = integral_constant<size_t, S>;
  18. using c_zero_t = c_size_t<0>;
  19. using c_true_t = c_bool_t<true>;
  20. using c_false_t = c_bool_t<false>;
  21. template<size_t S>
  22. constexpr c_size_t<S> c_size { };
  23. constexpr c_zero_t c_zero { };
  24. constexpr c_true_t c_true { };
  25. constexpr c_false_t c_false { };
  26. }
  27. }