simple_test.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #include <boost/mpl/assert.hpp>
  7. #include <boost/mpl/equal.hpp>
  8. #include <boost/mpl/vector.hpp>
  9. #include <boost/type_traits/is_same.hpp>
  10. #include <boost/function_types/components.hpp>
  11. #include <boost/function_types/function_type.hpp>
  12. #include <boost/function_types/member_function_pointer.hpp>
  13. namespace ft = boost::function_types;
  14. namespace mpl = boost::mpl;
  15. class C;
  16. typedef void func(C &);
  17. typedef int (C::* mem_func_ptr)(int);
  18. typedef ft::components<func> func_components;
  19. typedef ft::components<mem_func_ptr> mfp_components;
  20. BOOST_MPL_ASSERT((
  21. mpl::equal< func_components::types, mpl::vector<void,C &> >
  22. ));
  23. BOOST_MPL_ASSERT_RELATION(
  24. ::func_components::function_arity::value, ==, 1
  25. );
  26. BOOST_MPL_ASSERT((
  27. boost::is_same< ft::function_type< mpl::vector<void,C &> >::type, func >
  28. ));
  29. BOOST_MPL_ASSERT((
  30. mpl::equal< mfp_components::types, mpl::vector<int,C &,int> >
  31. ));
  32. BOOST_MPL_ASSERT_RELATION(
  33. ::mfp_components::function_arity::value, ==, 2
  34. );
  35. BOOST_MPL_ASSERT((
  36. boost::is_same< ft::member_function_pointer< mpl::vector<int,C &,int> >::type, mem_func_ptr >
  37. ));