pmf_varargs_4.hpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 enabled, 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_VARARGS_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 has_varargs = std::true_type;
  30. using traits = pmf;
  31. using return_type = Return;
  32. using type = Return(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
  33. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  34. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  35. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  36. using invoke_type = typename std::conditional<
  37. std::is_rvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::value,
  38. T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS,
  39. typename std::add_lvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::type
  40. >::type;
  41. using arg_types = std::tuple<invoke_type, Args...>;
  42. using non_invoke_arg_types = std::tuple<Args...>;
  43. using function_object_signature = Return(Args..., ...);
  44. using function_type = Return(invoke_type, Args..., ...);
  45. using qualified_function_type = Return(Args..., ...)
  46. BOOST_CLBL_TRTS_INCLUDE_ABOMINABLE_QUALIFIERS
  47. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  48. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  49. using remove_varargs =
  50. Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
  51. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  52. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  53. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  54. using add_varargs = type;
  55. using is_noexcept = BOOST_CLBL_TRTS_IS_NOEXCEPT;
  56. using remove_noexcept = Return(BOOST_CLBL_TRTS_CC T::*)(Args..., ...)
  57. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  58. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE;
  59. using add_noexcept = Return(BOOST_CLBL_TRTS_CC T::*)(Args..., ...)
  60. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  61. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  62. BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER;
  63. using is_transaction_safe = BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE;
  64. using remove_transaction_safe = Return(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
  65. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  66. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  67. using add_transaction_safe = Return(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
  68. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  69. BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
  70. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  71. using class_type = T;
  72. using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
  73. template<qualifier_flags Flags>
  74. using set_qualifiers = set_varargs_member_function_qualifiers<
  75. Flags, is_transaction_safe::value, is_noexcept::value,
  76. BOOST_CLBL_TRTS_CC_TAG, T, Return, Args...>;
  77. using remove_member_reference = set_qualifiers<qualifiers::cv_flags>;
  78. using add_member_lvalue_reference = set_qualifiers<
  79. collapse_flags<qualifiers::q_flags, lref_>::value>;
  80. using add_member_rvalue_reference = set_qualifiers<
  81. collapse_flags<qualifiers::q_flags, rref_>::value>;
  82. using add_member_const = set_qualifiers<qualifiers::q_flags | const_>;
  83. using add_member_volatile = set_qualifiers<qualifiers::q_flags | volatile_>;
  84. using add_member_cv = set_qualifiers<qualifiers::q_flags | cv_>;
  85. using remove_member_const = set_qualifiers<
  86. qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
  87. using remove_member_volatile = set_qualifiers<
  88. qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
  89. using remove_member_cv = set_qualifiers<qualifiers::ref_flags>;
  90. template<typename U>
  91. using apply_member_pointer =
  92. Return(BOOST_CLBL_TRTS_VARARGS_CC U::*)(Args..., ...)
  93. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  94. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  95. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  96. template<typename NewReturn>
  97. using apply_return =
  98. NewReturn(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
  99. BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
  100. BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
  101. BOOST_CLBL_TRTS_NOEXCEPT_SPEC;
  102. template<template<class...> class Container>
  103. using expand_args = Container<invoke_type, Args...>;
  104. using is_member_pointer = std::true_type;
  105. };