integral.hpp 959 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 <boost/mp11/version.hpp>
  10. #include <type_traits>
  11. #include <cstddef>
  12. namespace boost
  13. {
  14. namespace mp11
  15. {
  16. // mp_bool
  17. template<bool B> using mp_bool = std::integral_constant<bool, B>;
  18. using mp_true = mp_bool<true>;
  19. using mp_false = mp_bool<false>;
  20. // mp_to_bool
  21. template<class T> using mp_to_bool = mp_bool<static_cast<bool>( T::value )>;
  22. // mp_not<T>
  23. template<class T> using mp_not = mp_bool< !T::value >;
  24. // mp_int
  25. template<int I> using mp_int = std::integral_constant<int, I>;
  26. // mp_size_t
  27. template<std::size_t N> using mp_size_t = std::integral_constant<std::size_t, N>;
  28. } // namespace mp11
  29. } // namespace boost
  30. #endif // #ifndef BOOST_MP11_INTEGRAL_HPP_INCLUDED