1 #ifndef PHI_CORE_TO_ADDRESS_HPP 2 #define PHI_CORE_TO_ADDRESS_HPP 4 #include "phi/phi_config.hpp" 6 #if PHI_HAS_EXTENSION_PRAGMA_ONCE() 10 #include "phi/compiler_support/constexpr.hpp" 11 #include "phi/compiler_support/noexcept.hpp" 12 #include "phi/core/declval.hpp" 13 #include "phi/core/pointer_traits.hpp" 14 #include "phi/type_traits/conjunction.hpp" 15 #include "phi/type_traits/decay.hpp" 16 #include "phi/type_traits/enable_if.hpp" 17 #include "phi/type_traits/is_class.hpp" 18 #include "phi/type_traits/is_function.hpp" 20 DETAIL_PHI_BEGIN_NAMESPACE()
24 template <
typename TypeT>
25 PHI_CONSTEXPR TypeT* to_address_impl(TypeT* pointer) PHI_NOEXCEPT
28 "phi::detail::to_address_impl: TypeT must not be a function type");
32 template <
typename Po
interT,
typename =
void>
36 template <
typename Po
interT>
38 declval<const PointerT&>()))> :
public true_type 41 template <
typename Po
interT,
typename =
void>
45 template <
typename Po
interT>
47 decltype((void)declval<const PointerT&>().operator->())>
51 template <
typename Po
interT>
54 static PHI_CONSTEXPR_AND_CONST
bool value =
58 template <
typename Po
interT,
typename =
void>
62 template <
typename PointerT,
typename = enable_if_t<conjunction<
64 PHI_CONSTEXPR decay_t<
66 to_address_impl(
const PointerT& pointer) PHI_NOEXCEPT
71 template <
typename Po
interT,
typename>
74 static PHI_CONSTEXPR decltype(to_address_impl(declval<const PointerT&>().operator->()))
75 call(
const PointerT& pointer) PHI_NOEXCEPT
77 return to_address_impl(pointer.operator->());
81 template <
typename Po
interT>
83 declval<const PointerT&>()))>
86 declval<const PointerT&>()))
87 call(
const PointerT& pointer) PHI_NOEXCEPT
94 template <
typename TypeT>
95 PHI_CONSTEXPR
auto to_address(TypeT* pointer) PHI_NOEXCEPT
97 return detail::to_address_impl(pointer);
100 template <
typename Po
interT>
101 PHI_CONSTEXPR
auto to_address(
const PointerT& pointer) PHI_NOEXCEPT
102 -> decltype(detail::to_address_impl(pointer))
104 return detail::to_address_impl(pointer);
107 DETAIL_PHI_END_NAMESPACE()
109 #endif // PHI_CORE_TO_ADDRESS_HPP Definition: integral_constant.hpp:19
Definition: to_address.hpp:59
Definition: is_function.hpp:50
Definition: to_address.hpp:33
Definition: to_address.hpp:42
Definition: pointer_traits.hpp:109
Definition: to_address.hpp:52