detail_args_type_test.cpp 1012 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2015-2019 Hans Dembinski
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/core/lightweight_test_trait.hpp>
  7. #include <boost/histogram/detail/args_type.hpp>
  8. #include <tuple>
  9. #include "std_ostream.hpp"
  10. namespace dtl = boost::histogram::detail;
  11. struct Foo {
  12. int f1(char);
  13. int f2(long) const;
  14. static int f3(char, int);
  15. auto f4(char, int) { return 0; };
  16. };
  17. int main() {
  18. BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f1)>, std::tuple<char>);
  19. BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f2)>, std::tuple<long>);
  20. BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f3)>, std::tuple<char, int>);
  21. BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f4)>, std::tuple<char, int>);
  22. BOOST_TEST_TRAIT_SAME(dtl::arg_type<decltype(&Foo::f3)>, char);
  23. BOOST_TEST_TRAIT_SAME(dtl::arg_type<decltype(&Foo::f3), 1>, int);
  24. return boost::report_errors();
  25. }