is_callable_builtin.cpp 1.6 KB

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