is_member_function_pointer.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/function_types/is_member_function_pointer.hpp>
  8. namespace ft = boost::function_types;
  9. typedef void func();
  10. typedef void (*func_ptr)();
  11. typedef void (&func_ref)();
  12. class C;
  13. typedef void (C::*mem_func_ptr)();
  14. typedef void (C::*c_mem_func_ptr)() const;
  15. typedef void (C::*v_mem_func_ptr)() volatile;
  16. typedef void (C::*cv_mem_func_ptr)() const volatile;
  17. typedef int C::*mem_ptr;
  18. BOOST_MPL_ASSERT_NOT((
  19. ft::is_member_function_pointer< func >
  20. ));
  21. BOOST_MPL_ASSERT_NOT((
  22. ft::is_member_function_pointer< func_ptr >
  23. ));
  24. BOOST_MPL_ASSERT_NOT((
  25. ft::is_member_function_pointer< func_ref >
  26. ));
  27. BOOST_MPL_ASSERT((
  28. ft::is_member_function_pointer< mem_func_ptr >
  29. ));
  30. BOOST_MPL_ASSERT((
  31. ft::is_member_function_pointer< c_mem_func_ptr >
  32. ));
  33. BOOST_MPL_ASSERT((
  34. ft::is_member_function_pointer< v_mem_func_ptr >
  35. ));
  36. BOOST_MPL_ASSERT((
  37. ft::is_member_function_pointer< cv_mem_func_ptr >
  38. ));
  39. BOOST_MPL_ASSERT_NOT((
  40. ft::is_member_function_pointer< mem_ptr >
  41. ));
  42. BOOST_MPL_ASSERT_NOT((
  43. ft::is_member_function_pointer< func_ptr* >
  44. ));
  45. BOOST_MPL_ASSERT_NOT((
  46. ft::is_member_function_pointer< mem_func_ptr* >
  47. ));
  48. BOOST_MPL_ASSERT_NOT((
  49. ft::is_member_function_pointer< mem_ptr* >
  50. ));
  51. BOOST_MPL_ASSERT_NOT((
  52. ft::is_member_function_pointer< C >
  53. ));
  54. BOOST_MPL_ASSERT_NOT((
  55. ft::is_member_function_pointer< int >
  56. ));
  57. BOOST_MPL_ASSERT_NOT((
  58. ft::is_member_function_pointer< int* >
  59. ));
  60. BOOST_MPL_ASSERT_NOT((
  61. ft::is_member_function_pointer< int** >
  62. ));
  63. BOOST_MPL_ASSERT_NOT((
  64. ft::is_member_function_pointer< int& >
  65. ));
  66. BOOST_MPL_ASSERT_NOT((
  67. ft::is_member_function_pointer< int[] >
  68. ));
  69. BOOST_MPL_ASSERT_NOT((
  70. ft::is_member_function_pointer< int[1] >
  71. ));