is_member_pointer.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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_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_pointer< func >
  20. ));
  21. BOOST_MPL_ASSERT_NOT((
  22. ft::is_member_pointer< func_ptr >
  23. ));
  24. BOOST_MPL_ASSERT_NOT((
  25. ft::is_member_pointer< func_ref >
  26. ));
  27. BOOST_MPL_ASSERT((
  28. ft::is_member_pointer< mem_func_ptr >
  29. ));
  30. BOOST_MPL_ASSERT((
  31. ft::is_member_pointer< c_mem_func_ptr >
  32. ));
  33. BOOST_MPL_ASSERT((
  34. ft::is_member_pointer< v_mem_func_ptr >
  35. ));
  36. BOOST_MPL_ASSERT((
  37. ft::is_member_pointer< cv_mem_func_ptr >
  38. ));
  39. BOOST_MPL_ASSERT((
  40. ft::is_member_pointer< mem_ptr >
  41. ));
  42. BOOST_MPL_ASSERT_NOT((
  43. ft::is_member_pointer< func_ptr* >
  44. ));
  45. BOOST_MPL_ASSERT_NOT((
  46. ft::is_member_pointer< mem_func_ptr* >
  47. ));
  48. BOOST_MPL_ASSERT_NOT((
  49. ft::is_member_pointer< mem_ptr* >
  50. ));
  51. BOOST_MPL_ASSERT_NOT((
  52. ft::is_member_pointer< C >
  53. ));
  54. BOOST_MPL_ASSERT_NOT((
  55. ft::is_member_pointer< int >
  56. ));
  57. BOOST_MPL_ASSERT_NOT((
  58. ft::is_member_pointer< int* >
  59. ));
  60. BOOST_MPL_ASSERT_NOT((
  61. ft::is_member_pointer< int** >
  62. ));
  63. BOOST_MPL_ASSERT_NOT((
  64. ft::is_member_pointer< int& >
  65. ));