mp_max.cpp 931 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2017 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/mp11/detail/config.hpp>
  8. #if BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 )
  9. # pragma GCC diagnostic ignored "-Wsign-compare"
  10. #endif
  11. #include <boost/mp11/function.hpp>
  12. #include <boost/mp11/integral.hpp>
  13. #include <boost/core/lightweight_test_trait.hpp>
  14. #include <type_traits>
  15. int main()
  16. {
  17. using boost::mp11::mp_max;
  18. using boost::mp11::mp_int;
  19. using boost::mp11::mp_size_t;
  20. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_max<mp_int<1>>, mp_int<1>>));
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_max<mp_int<2>, mp_int<1>, mp_int<2>, mp_int<3>>, mp_int<3>>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_max<mp_int<-1>, mp_size_t<1>, mp_int<-2>, mp_size_t<2>>, mp_size_t<2>>));
  23. return boost::report_errors();
  24. }