member_function_pointer.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/vector.hpp>
  8. #include <boost/type_traits/is_same.hpp>
  9. #include <boost/function_types/member_function_pointer.hpp>
  10. namespace ft = boost::function_types;
  11. namespace mpl = boost::mpl;
  12. using boost::is_same;
  13. class C;
  14. typedef int (C::* expected1)(int);
  15. typedef int (C::* expected2)(int) const;
  16. typedef int (C::* expected3)(int) volatile;
  17. typedef int (C::* expected4)(int) const volatile;
  18. BOOST_MPL_ASSERT((
  19. is_same< ft::member_function_pointer< mpl::vector<int,C,int> >::type
  20. , expected1 >
  21. ));
  22. BOOST_MPL_ASSERT((
  23. is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
  24. ft::tag<ft::non_const, ft::non_volatile> >::type
  25. , expected1 >
  26. ));
  27. BOOST_MPL_ASSERT((
  28. is_same< ft::member_function_pointer< mpl::vector<int,C,int>
  29. , ft::const_qualified >::type
  30. , expected2 >
  31. ));
  32. BOOST_MPL_ASSERT((
  33. is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
  34. ft::tag<ft::const_qualified, ft::non_volatile> >::type
  35. , expected2 >
  36. ));
  37. BOOST_MPL_ASSERT((
  38. is_same< ft::member_function_pointer< mpl::vector<int,C,int>
  39. , ft::volatile_qualified >::type
  40. , expected3 >
  41. ));
  42. BOOST_MPL_ASSERT((
  43. is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
  44. ft::tag<ft::non_const, ft::volatile_qualified> >::type
  45. , expected3 >
  46. ));
  47. BOOST_MPL_ASSERT((
  48. is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
  49. ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
  50. , expected4 >
  51. ));