pmf_4.hpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. HEADER GUARDS INTENTIONALLY OMITTED
  6. DO NOT INCLUDE THIS HEADER DIRECTLY
  7. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS - the function-level qualifiers for the
  8. current inclusion (combinations of `const` `volatile` `&` `&&`, or nothing)
  9. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE - the transaction_safe specifier for
  10. the current include (`transaction_safe` or nothing)
  11. BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `std::true_type` or `std::false_type`,
  12. tied on whether BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE is `transaction_safe`
  13. BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
  14. BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE is defined, otherwise nothing
  15. BOOST_CLBL_TRTS_NOEXCEPT_SPEC - the noexcept specifier for
  16. the current include (`noexcept` or nothing)
  17. BOOST_CLBL_TRTS_IS_NOEXCEPT - `std::true_type` or `std::false_type`,
  18. tied on whether BOOST_CLBL_TRTS_NOEXCEPT_SPEC is `noexcept`
  19. BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER - `noexcept` if
  20. BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES is defined, otherwise nothing
  21. */
  22. template<typename Return, typename T, typename... Args>
  23. struct pmf<Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  24. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  25. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  26. BOOST_CLBL_TRTS_NOEXCEPT_SPEC>
  27. : default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS> {
  28. static constexpr bool value = true;
  29. using traits = pmf;
  30. using return_type = Return;
  31. using type = Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  32. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  33. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  34. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  35. using invoke_type = typename std::conditional<
  36. std::is_rvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::value,
  37. T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS,
  38. typename std::add_lvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::type
  39. >::type;
  40. using arg_types = std::tuple<invoke_type, Args...>;
  41. using non_invoke_arg_types = std::tuple<Args...>;
  42. using function_object_signature = Return(Args...);
  43. using function_type = Return(invoke_type, Args...);
  44. using qualified_function_type = Return(Args...)
  45. BOOST_CLBL_TRTS_INCLUDE_ABOMINABLE_QUALIFIERS
  46. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  47. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  48. using remove_varargs = type;
  49. using add_varargs =
  50. Return(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
  51. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  52. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  53. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  54. using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
  55. using remove_noexcept = Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  56. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  57. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE;
  58. using add_noexcept = Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  59. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  60. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  61. BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
  62. using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
  63. using remove_transaction_safe = Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  64. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  65. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  66. using add_transaction_safe = Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  67. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  68. BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
  69. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  70. using class_type = T;
  71. using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
  72. template<qualifier_flags Flags>
  73. using set_qualifiers = set_member_function_qualifiers<
  74. Flags, is_transaction_safe::value, is_noexcept::value,
  75. BOOST_CLBL_TRTS_CC_TAG, T, Return, Args...>;
  76. using remove_member_reference = set_qualifiers<qualifiers::cv_flags>;
  77. using add_member_lvalue_reference = set_qualifiers<
  78. collapse_flags<qualifiers::q_flags, lref_>::value>;
  79. using add_member_rvalue_reference = set_qualifiers<
  80. collapse_flags<qualifiers::q_flags, rref_>::value>;
  81. using add_member_const = set_qualifiers<qualifiers::q_flags | const_>;
  82. using add_member_volatile = set_qualifiers<qualifiers::q_flags | volatile_>;
  83. using add_member_cv = set_qualifiers<qualifiers::q_flags | cv_>;
  84. using remove_member_const = set_qualifiers<
  85. qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
  86. using remove_member_volatile = set_qualifiers<
  87. qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
  88. using remove_member_cv = set_qualifiers<qualifiers::ref_flags>;
  89. template<typename U>
  90. using apply_member_pointer =
  91. Return(BOOST_CLBL_TRTS_CC U::*)(Args...)
  92. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  93. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  94. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  95. template<typename NewReturn>
  96. using apply_return =
  97. NewReturn(BOOST_CLBL_TRTS_CC T::*)(Args...)
  98. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  99. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  100. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  101. template<template<class...> class Container>
  102. using expand_args = Container<invoke_type, Args...>;
  103. using is_member_pointer = std::true_type;
  104. };