File indexing completed on 2024-11-15 09:33:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_TT_HAS_MINUS_HPP_INCLUDED
0010 #define BOOST_TT_HAS_MINUS_HPP_INCLUDED
0011
0012 #include <boost/config.hpp>
0013 #include <boost/type_traits/detail/config.hpp>
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #if defined(__GNUC__)
0028 # pragma GCC system_header
0029 #elif defined(BOOST_MSVC)
0030 # pragma warning ( push )
0031 # pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 4133)
0032 # if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
0033 # pragma warning ( disable : 6334)
0034 # endif
0035 #endif
0036
0037 #if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION)
0038
0039 #include <boost/type_traits/integral_constant.hpp>
0040 #include <boost/type_traits/make_void.hpp>
0041 #include <boost/type_traits/is_convertible.hpp>
0042 #include <boost/type_traits/is_void.hpp>
0043 #include <boost/type_traits/add_reference.hpp>
0044 #include <boost/type_traits/remove_pointer.hpp>
0045 #include <boost/type_traits/remove_reference.hpp>
0046 #include <utility>
0047
0048 namespace boost
0049 {
0050
0051 namespace binary_op_detail {
0052
0053 struct dont_care;
0054
0055 template <class T, class U, class Ret, class = void>
0056 struct has_minus_ret_imp : public boost::false_type {};
0057
0058 template <class T, class U, class Ret>
0059 struct has_minus_ret_imp<T, U, Ret, typename boost::make_void<decltype(std::declval<typename add_reference<T>::type>() - std::declval<typename add_reference<U>::type>())>::type>
0060 : public boost::integral_constant<bool, ::boost::is_convertible<decltype(std::declval<typename add_reference<T>::type>() - std::declval<typename add_reference<U>::type>()), Ret>::value> {};
0061
0062 template <class T, class U, class = void >
0063 struct has_minus_void_imp : public boost::false_type {};
0064
0065 template <class T, class U>
0066 struct has_minus_void_imp<T, U, typename boost::make_void<decltype(std::declval<typename add_reference<T>::type>() - std::declval<typename add_reference<U>::type>())>::type>
0067 : public boost::integral_constant<bool, ::boost::is_void<decltype(std::declval<typename add_reference<T>::type>() - std::declval<typename add_reference<U>::type>())>::value> {};
0068
0069 template <class T, class U, class = void>
0070 struct has_minus_dc_imp : public boost::false_type {};
0071
0072 template <class T, class U>
0073 struct has_minus_dc_imp<T, U, typename boost::make_void<decltype(std::declval<typename add_reference<T>::type>() - std::declval<typename add_reference<U>::type>())>::type>
0074 : public boost::true_type {};
0075
0076 template <class T, class U, class Ret>
0077 struct has_minus_ret_filter : public boost::binary_op_detail::has_minus_ret_imp <T, U, Ret> {};
0078 template <class T, class U>
0079 struct has_minus_ret_filter<T, U, void> : public boost::binary_op_detail::has_minus_void_imp <T, U> {};
0080 template <class T, class U>
0081 struct has_minus_ret_filter<T, U, boost::binary_op_detail::dont_care> : public boost::binary_op_detail::has_minus_dc_imp <T, U> {};
0082
0083 template <class T, class U, class Ret, bool b>
0084 struct has_minus_void_ptr_filter : public boost::binary_op_detail::has_minus_ret_filter <T, U, Ret> {};
0085 template <class T, class U, class Ret>
0086 struct has_minus_void_ptr_filter<T, U, Ret, true> : public boost::false_type {};
0087
0088 }
0089
0090 template <class T, class U = T, class Ret = boost::binary_op_detail::dont_care>
0091 struct has_minus :
0092 public boost::binary_op_detail::has_minus_void_ptr_filter<
0093 T, U, Ret,
0094 boost::is_void<typename remove_pointer<typename remove_reference<T>::type>::type>::value
0095 || boost::is_void<typename remove_pointer<typename remove_reference<U>::type>::type>::value> {};
0096
0097
0098 }
0099
0100 #else
0101
0102
0103 #define BOOST_TT_TRAIT_NAME has_minus
0104 #define BOOST_TT_TRAIT_OP -
0105 #define BOOST_TT_FORBIDDEN_IF\
0106 (\
0107 \
0108 (\
0109 ::boost::is_pointer< Lhs_noref >::value && \
0110 ::boost::is_fundamental< Rhs_nocv >::value && \
0111 (! ::boost::is_integral< Rhs_noref >::value )\
0112 ) || \
0113 \
0114 (\
0115 ::boost::is_pointer< Lhs_noref >::value && \
0116 ::boost::is_void< Lhs_noptr >::value && \
0117 ( \
0118 ::boost::is_fundamental< Rhs_nocv >::value || \
0119 ::boost::is_pointer< Rhs_noref >::value\
0120 )\
0121 ) || \
0122 \
0123 (\
0124 ::boost::is_pointer< Rhs_noref >::value && \
0125 ::boost::is_void< Rhs_noptr >::value && \
0126 (\
0127 ::boost::is_fundamental< Lhs_nocv >::value || \
0128 ::boost::is_pointer< Lhs_noref >::value\
0129 )\
0130 ) ||\
0131 \
0132 (\
0133 ::boost::is_fundamental< Lhs_nocv >::value && \
0134 ::boost::is_pointer< Rhs_noref >::value\
0135 ) ||\
0136 \
0137 (\
0138 ::boost::is_pointer< Lhs_noref >::value && \
0139 ::boost::is_pointer< Rhs_noref >::value && \
0140 (! ::boost::is_same< Lhs_nocv, Rhs_nocv >::value )\
0141 )\
0142 )
0143
0144 #define BOOST_TT_FORBIDDEN_IF_NEW (boost::is_void<typename remove_pointer<typename boost::remove_reference<T>::type>::type>::value || boost::is_void<typename remove_pointer<typename boost::remove_reference<U>::type>::type>::value)
0145
0146 #include <boost/type_traits/detail/has_binary_operator.hpp>
0147
0148 #undef BOOST_TT_TRAIT_NAME
0149 #undef BOOST_TT_TRAIT_OP
0150 #undef BOOST_TT_FORBIDDEN_IF
0151
0152 #endif
0153
0154 #if defined(BOOST_MSVC)
0155 # pragma warning (pop)
0156 #endif
0157
0158 #endif