is_cv_pointer.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_function_pointer.hpp>
  8. #include <boost/function_types/is_member_function_pointer.hpp>
  9. namespace ft = boost::function_types;
  10. typedef void(* const func_c_ptr)();
  11. typedef void(* volatile func_v_ptr)();
  12. typedef void(* const volatile func_cv_ptr)();
  13. class C;
  14. typedef void(C::* const mem_func_c_ptr)();
  15. typedef void(C::* volatile mem_func_v_ptr)();
  16. typedef void(C::* const volatile mem_func_cv_ptr)();
  17. // note: the pointer has cv-qualifiers, not the function - non_cv tag must match
  18. BOOST_MPL_ASSERT((
  19. ft::is_function_pointer< func_c_ptr, ft::non_cv >
  20. ));
  21. BOOST_MPL_ASSERT((
  22. ft::is_function_pointer< func_v_ptr, ft::non_cv >
  23. ));
  24. BOOST_MPL_ASSERT((
  25. ft::is_function_pointer< func_cv_ptr, ft::non_cv >
  26. ));
  27. BOOST_MPL_ASSERT((
  28. ft::is_member_function_pointer< mem_func_c_ptr, ft::non_cv >
  29. ));
  30. BOOST_MPL_ASSERT((
  31. ft::is_member_function_pointer< mem_func_v_ptr, ft::non_cv >
  32. ));
  33. BOOST_MPL_ASSERT((
  34. ft::is_member_function_pointer< mem_func_cv_ptr, ft::non_cv >
  35. ));