apply_member_pointer_function.cpp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*<-
  2. Copyright (c) 2016 Barrett Adair
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  5. ->*/
  6. #include <boost/callable_traits/apply_member_pointer.hpp>
  7. #include "test.hpp"
  8. struct foo;
  9. template<typename Input, typename Output>
  10. void test_case() {
  11. assert_same<TRAIT(apply_member_pointer, Input, foo), Output>();
  12. }
  13. int main() {
  14. test_case<int(), int(foo::*)() >();
  15. #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  16. test_case<int() TX_SAFE, int(foo::*)() TX_SAFE >();
  17. test_case<int() LREF, int(foo::*)() LREF >();
  18. test_case<int() LREF TX_SAFE, int(foo::*)() LREF TX_SAFE >();
  19. test_case<int() RREF, int(foo::*)() RREF >();
  20. test_case<int() RREF TX_SAFE, int(foo::*)() RREF TX_SAFE >();
  21. test_case<int() const, int(foo::*)() const >();
  22. test_case<int() const TX_SAFE, int(foo::*)() const TX_SAFE >();
  23. test_case<int() const LREF, int(foo::*)() const LREF >();
  24. test_case<int() const LREF TX_SAFE, int(foo::*)() const LREF TX_SAFE >();
  25. test_case<int() const RREF, int(foo::*)() const RREF >();
  26. test_case<int() const RREF TX_SAFE, int(foo::*)() const RREF TX_SAFE >();
  27. test_case<int() volatile, int(foo::*)() volatile >();
  28. test_case<int() volatile TX_SAFE, int(foo::*)() volatile TX_SAFE >();
  29. test_case<int() volatile LREF, int(foo::*)() volatile LREF >();
  30. test_case<int() volatile LREF TX_SAFE, int(foo::*)() volatile LREF TX_SAFE >();
  31. test_case<int() volatile RREF, int(foo::*)() volatile RREF >();
  32. test_case<int() volatile RREF TX_SAFE, int(foo::*)() volatile RREF TX_SAFE >();
  33. #endif
  34. test_case<int(int), int(foo::*)(int) >();
  35. #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  36. test_case<int(int) TX_SAFE, int(foo::*)(int) TX_SAFE >();
  37. test_case<int(int) LREF, int(foo::*)(int) LREF >();
  38. test_case<int(int) LREF TX_SAFE, int(foo::*)(int) LREF TX_SAFE >();
  39. test_case<int(int) RREF, int(foo::*)(int) RREF >();
  40. test_case<int(int) RREF TX_SAFE, int(foo::*)(int) RREF TX_SAFE >();
  41. test_case<int(int) const, int(foo::*)(int) const >();
  42. test_case<int(int) const TX_SAFE, int(foo::*)(int) const TX_SAFE >();
  43. test_case<int(int) const LREF, int(foo::*)(int) const LREF >();
  44. test_case<int(int) const LREF TX_SAFE, int(foo::*)(int) const LREF TX_SAFE >();
  45. test_case<int(int) const RREF, int(foo::*)(int) const RREF >();
  46. test_case<int(int) const RREF TX_SAFE, int(foo::*)(int) const RREF TX_SAFE >();
  47. test_case<int(int) volatile, int(foo::*)(int) volatile >();
  48. test_case<int(int) volatile TX_SAFE, int(foo::*)(int) volatile TX_SAFE >();
  49. test_case<int(int) volatile LREF, int(foo::*)(int) volatile LREF >();
  50. test_case<int(int) volatile LREF TX_SAFE, int(foo::*)(int) volatile LREF TX_SAFE >();
  51. test_case<int(int) volatile RREF, int(foo::*)(int) volatile RREF >();
  52. test_case<int(int) volatile RREF TX_SAFE, int(foo::*)(int) volatile RREF TX_SAFE >();
  53. #endif
  54. //MSVC doesn't like varargs on abominable functions
  55. #ifndef BOOST_CLBL_TRTS_MSVC
  56. test_case<int(...), int(foo::*)(...) >();
  57. #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  58. test_case<int(...) TX_SAFE, int(foo::*)(...) TX_SAFE >();
  59. test_case<int(...) LREF, int(foo::*)(...) LREF >();
  60. test_case<int(...) LREF TX_SAFE, int(foo::*)(...) LREF TX_SAFE >();
  61. test_case<int(...) RREF, int(foo::*)(...) RREF >();
  62. test_case<int(...) RREF TX_SAFE, int(foo::*)(...) RREF TX_SAFE >();
  63. test_case<int(...) const, int(foo::*)(...) const >();
  64. test_case<int(...) const TX_SAFE, int(foo::*)(...) const TX_SAFE >();
  65. test_case<int(...) const LREF, int(foo::*)(...) const LREF >();
  66. test_case<int(...) const LREF TX_SAFE, int(foo::*)(...) const LREF TX_SAFE >();
  67. test_case<int(...) const RREF, int(foo::*)(...) const RREF >();
  68. test_case<int(...) const RREF TX_SAFE, int(foo::*)(...) const RREF TX_SAFE >();
  69. test_case<int(...) volatile, int(foo::*)(...) volatile >();
  70. test_case<int(...) volatile TX_SAFE, int(foo::*)(...) volatile TX_SAFE >();
  71. test_case<int(...) volatile LREF, int(foo::*)(...) volatile LREF >();
  72. test_case<int(...) volatile LREF TX_SAFE, int(foo::*)(...) volatile LREF TX_SAFE >();
  73. test_case<int(...) volatile RREF, int(foo::*)(...) volatile RREF >();
  74. test_case<int(...) volatile RREF TX_SAFE, int(foo::*)(...) volatile RREF TX_SAFE >();
  75. #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  76. test_case<int(int, ...), int(foo::*)(int, ...) >();
  77. #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  78. test_case<int(int, ...) TX_SAFE, int(foo::*)(int, ...) TX_SAFE >();
  79. test_case<int(int, ...) LREF, int(foo::*)(int, ...) LREF >();
  80. test_case<int(int, ...) LREF TX_SAFE, int(foo::*)(int, ...) LREF TX_SAFE >();
  81. test_case<int(int, ...) RREF, int(foo::*)(int, ...) RREF >();
  82. test_case<int(int, ...) RREF TX_SAFE, int(foo::*)(int, ...) RREF TX_SAFE >();
  83. test_case<int(int, ...) const, int(foo::*)(int, ...) const >();
  84. test_case<int(int, ...) const TX_SAFE, int(foo::*)(int, ...) const TX_SAFE >();
  85. test_case<int(int, ...) const LREF, int(foo::*)(int, ...) const LREF >();
  86. test_case<int(int, ...) const LREF TX_SAFE, int(foo::*)(int, ...) const LREF TX_SAFE >();
  87. test_case<int(int, ...) const RREF, int(foo::*)(int, ...) const RREF >();
  88. test_case<int(int, ...) const RREF TX_SAFE, int(foo::*)(int, ...) const RREF TX_SAFE >();
  89. test_case<int(int, ...) volatile, int(foo::*)(int, ...) volatile >();
  90. test_case<int(int, ...) volatile TX_SAFE, int(foo::*)(int, ...) volatile TX_SAFE >();
  91. test_case<int(int, ...) volatile LREF, int(foo::*)(int, ...) volatile LREF >();
  92. test_case<int(int, ...) volatile LREF TX_SAFE, int(foo::*)(int, ...) volatile LREF TX_SAFE >();
  93. test_case<int(int, ...) volatile RREF, int(foo::*)(int, ...) volatile RREF >();
  94. test_case<int(int, ...) volatile RREF TX_SAFE, int(foo::*)(int, ...) volatile RREF TX_SAFE >();
  95. #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  96. #endif //#ifndef BOOST_CLBL_TRTS_MSVC
  97. }