integral.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <boost/mp11/detail/mp_value.hpp>
  11. #include <type_traits>
  12. #include <cstddef>
  13. #if defined(_MSC_VER) || defined(__GNUC__)
  14. # pragma push_macro( "I" )
  15. # undef I
  16. #endif
  17. namespace boost
  18. {
  19. namespace mp11
  20. {
  21. // mp_bool
  22. template<bool B> using mp_bool = std::integral_constant<bool, B>;
  23. using mp_true = mp_bool<true>;
  24. using mp_false = mp_bool<false>;
  25. // mp_to_bool
  26. template<class T> using mp_to_bool = mp_bool<static_cast<bool>( T::value )>;
  27. // mp_not<T>
  28. template<class T> using mp_not = mp_bool< !T::value >;
  29. // mp_int
  30. template<int I> using mp_int = std::integral_constant<int, I>;
  31. // mp_size_t
  32. template<std::size_t N> using mp_size_t = std::integral_constant<std::size_t, N>;
  33. } // namespace mp11
  34. } // namespace boost
  35. #if defined(_MSC_VER) || defined(__GNUC__)
  36. # pragma pop_macro( "I" )
  37. #endif
  38. #endif // #ifndef BOOST_MP11_INTEGRAL_HPP_INCLUDED