result_arg_types_test.cpp 930 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Boost.Function library
  2. // Copyright 2016 Peter Dimov
  3. // Use, modification and distribution is subject to
  4. // the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/function.hpp>
  8. #include <boost/core/is_same.hpp>
  9. #include <boost/core/lightweight_test_trait.hpp>
  10. struct X
  11. {
  12. };
  13. struct Y
  14. {
  15. };
  16. struct Z
  17. {
  18. };
  19. int main()
  20. {
  21. typedef boost::function<X(Y)> F1;
  22. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F1::result_type, X> ));
  23. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F1::argument_type, Y> ));
  24. typedef boost::function<X(Y, Z)> F2;
  25. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::result_type, X> ));
  26. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::first_argument_type, Y> ));
  27. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::second_argument_type, Z> ));
  28. return boost::report_errors();
  29. }