integral.hpp 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef BOOST_MP11_INTEGRAL_HPP_INCLUDED
  2. #define BOOST_MP11_INTEGRAL_HPP_INCLUDED
  3. // Copyright 2015 Peter Dimov.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. //
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. #include <type_traits>
  10. #include <cstddef>
  11. namespace boost
  12. {
  13. namespace mp11
  14. {
  15. // mp_bool
  16. template<bool B> using mp_bool = std::integral_constant<bool, B>;
  17. using mp_true = mp_bool<true>;
  18. using mp_false = mp_bool<false>;
  19. // mp_to_bool
  20. template<class T> using mp_to_bool = mp_bool<static_cast<bool>( T::value )>;
  21. // mp_not<T>
  22. template<class T> using mp_not = mp_bool< !T::value >;
  23. // mp_int
  24. template<int I> using mp_int = std::integral_constant<int, I>;
  25. // mp_size_t
  26. template<std::size_t N> using mp_size_t = std::integral_constant<std::size_t, N>;
  27. } // namespace mp11
  28. } // namespace boost
  29. #endif // #ifndef BOOST_MP11_INTEGRAL_HPP_INCLUDED