mp_not_fn.cpp 956 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2019 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/utility.hpp>
  8. #include <boost/core/lightweight_test_trait.hpp>
  9. #include <type_traits>
  10. template<class T> using is_const_ = std::is_const<T>;
  11. struct Q_is_const
  12. {
  13. template<class T> using fn = std::is_const<T>;
  14. };
  15. int main()
  16. {
  17. using boost::mp11::mp_not_fn;
  18. using boost::mp11::mp_not_fn_q;
  19. BOOST_TEST_TRAIT_TRUE((mp_not_fn<std::is_const>::fn<void>));
  20. BOOST_TEST_TRAIT_FALSE((mp_not_fn<std::is_const>::fn<void const>));
  21. BOOST_TEST_TRAIT_TRUE((mp_not_fn<is_const_>::fn<void>));
  22. BOOST_TEST_TRAIT_FALSE((mp_not_fn<is_const_>::fn<void const>));
  23. BOOST_TEST_TRAIT_TRUE((mp_not_fn_q<Q_is_const>::fn<void>));
  24. BOOST_TEST_TRAIT_FALSE((mp_not_fn_q<Q_is_const>::fn<void const>));
  25. return boost::report_errors();
  26. }