is_variadic.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 nv_func();
  11. typedef void (*func_ptr)(...);
  12. typedef void (*nv_func_ptr)();
  13. typedef void (&func_ref)(...);
  14. typedef void (&nv_func_ref)();
  15. class C;
  16. typedef void (C::*mem_func_ptr)(...);
  17. typedef void (C::*nv_mem_func_ptr)();
  18. typedef void (C::*c_mem_func_ptr)(...) const;
  19. typedef void (C::*v_mem_func_ptr)(...) volatile;
  20. typedef void (C::*cv_mem_func_ptr)(...) const volatile;
  21. typedef int C::* mem_ptr;
  22. BOOST_MPL_ASSERT((
  23. ft::is_callable_builtin< func >
  24. ));
  25. BOOST_MPL_ASSERT((
  26. ft::is_callable_builtin< func, ft::variadic >
  27. ));
  28. BOOST_MPL_ASSERT_NOT((
  29. ft::is_callable_builtin< func, ft::non_variadic >
  30. ));
  31. BOOST_MPL_ASSERT((
  32. ft::is_callable_builtin< nv_func >
  33. ));
  34. BOOST_MPL_ASSERT_NOT((
  35. ft::is_callable_builtin< nv_func, ft::variadic >
  36. ));
  37. BOOST_MPL_ASSERT((
  38. ft::is_callable_builtin< nv_func, ft::non_variadic >
  39. ));
  40. BOOST_MPL_ASSERT((
  41. ft::is_callable_builtin< func_ptr >
  42. ));
  43. BOOST_MPL_ASSERT((
  44. ft::is_callable_builtin< func_ptr, ft::variadic>
  45. ));
  46. BOOST_MPL_ASSERT_NOT((
  47. ft::is_callable_builtin< func_ptr, ft::non_variadic >
  48. ));
  49. BOOST_MPL_ASSERT((
  50. ft::is_callable_builtin< nv_func_ptr >
  51. ));
  52. BOOST_MPL_ASSERT_NOT((
  53. ft::is_callable_builtin< nv_func_ptr, ft::variadic>
  54. ));
  55. BOOST_MPL_ASSERT((
  56. ft::is_callable_builtin< nv_func_ptr, ft::non_variadic >
  57. ));
  58. BOOST_MPL_ASSERT((
  59. ft::is_callable_builtin< func_ref >
  60. ));
  61. BOOST_MPL_ASSERT((
  62. ft::is_callable_builtin< mem_func_ptr >
  63. ));
  64. BOOST_MPL_ASSERT((
  65. ft::is_callable_builtin< mem_func_ptr, ft::variadic >
  66. ));
  67. BOOST_MPL_ASSERT_NOT((
  68. ft::is_callable_builtin< mem_func_ptr, ft::non_variadic >
  69. ));
  70. BOOST_MPL_ASSERT((
  71. ft::is_callable_builtin< nv_mem_func_ptr >
  72. ));
  73. BOOST_MPL_ASSERT_NOT((
  74. ft::is_callable_builtin< nv_mem_func_ptr, ft::variadic >
  75. ));
  76. BOOST_MPL_ASSERT((
  77. ft::is_callable_builtin< nv_mem_func_ptr, ft::non_variadic >
  78. ));
  79. BOOST_MPL_ASSERT((
  80. ft::is_callable_builtin< c_mem_func_ptr >
  81. ));
  82. BOOST_MPL_ASSERT((
  83. ft::is_callable_builtin< v_mem_func_ptr >
  84. ));
  85. BOOST_MPL_ASSERT((
  86. ft::is_callable_builtin< cv_mem_func_ptr >
  87. ));
  88. BOOST_MPL_ASSERT_NOT((
  89. ft::is_callable_builtin< func_ptr* >
  90. ));
  91. BOOST_MPL_ASSERT_NOT((
  92. ft::is_callable_builtin< mem_func_ptr* >
  93. ));
  94. BOOST_MPL_ASSERT_NOT((
  95. ft::is_callable_builtin< C, ft::variadic >
  96. ));
  97. BOOST_MPL_ASSERT_NOT((
  98. ft::is_callable_builtin< C, ft::non_variadic >
  99. ));
  100. BOOST_MPL_ASSERT((
  101. ft::is_callable_builtin< mem_ptr >
  102. ));
  103. BOOST_MPL_ASSERT_NOT((
  104. ft::is_callable_builtin< mem_ptr, ft::variadic >
  105. ));
  106. BOOST_MPL_ASSERT((
  107. ft::is_callable_builtin< mem_ptr, ft::non_variadic >
  108. ));