File indexing completed on 2025-01-18 09:29:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_CLBL_TRTS_APPLY_MEMBER_POINTER_HPP
0010 #define BOOST_CLBL_TRTS_APPLY_MEMBER_POINTER_HPP
0011
0012 #include <boost/callable_traits/detail/core.hpp>
0013
0014 namespace boost { namespace callable_traits {
0015
0016 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(apply_member_pointer)
0017 BOOST_CLBL_TRTS_SFINAE_MSG(apply_member_pointer, members_cannot_have_a_type_of_void)
0018 BOOST_CLBL_TRTS_SFINAE_MSG(apply_member_pointer, second_template_argument_must_be_a_class_or_struct)
0019
0020 namespace detail {
0021
0022 template<typename T, typename C, bool = std::is_class<C>::value>
0023 struct make_member_pointer;
0024
0025 template<typename T, typename C>
0026 struct make_member_pointer<T, C, true> {
0027 using type = typename std::remove_reference<T>::type C::*;
0028 };
0029
0030 template<typename C>
0031 struct make_member_pointer<void, C, true> {
0032 using type = invalid_type;
0033 };
0034
0035 template<typename T, typename C>
0036 struct make_member_pointer<T, C, false> {
0037 using type = error_type<T>;
0038 };
0039
0040 template<typename T, typename C>
0041 using make_member_pointer_t = typename make_member_pointer<T, C>::type;
0042 }
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 template<typename T, typename C>
0053 using apply_member_pointer_t =
0054
0055 detail::sfinae_try<
0056 detail::fallback_if_invalid<
0057 typename detail::traits<T>::template apply_member_pointer<C>,
0058 typename detail::make_member_pointer<T, C>::type>,
0059
0060 detail::fail_when_same<void, T, members_cannot_have_a_type_of_void>,
0061
0062 detail::fail_if<!std::is_class<C>::value,
0063 second_template_argument_must_be_a_class_or_struct> >;
0064
0065 namespace detail {
0066
0067 template<typename T, typename C, typename = std::false_type>
0068 struct apply_member_pointer_impl {};
0069
0070 template<typename T, typename C>
0071 struct apply_member_pointer_impl <T, C, typename std::is_same<
0072 apply_member_pointer_t<T, C>, detail::dummy>::type>
0073 {
0074 using type = apply_member_pointer_t<T, C>;
0075 };
0076 }
0077
0078
0079
0080 template<typename T, typename C>
0081 struct apply_member_pointer : detail::apply_member_pointer_impl<T, C> {};
0082
0083
0084 }}
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 #endif