]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/type_traits/has_minus_assign.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / type_traits / has_minus_assign.hpp
1 // (C) Copyright 2009-2011 Frederic Bron.
2 //
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
6 //
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9 #ifndef BOOST_TT_has_minus_assign_ASSIGN_HPP_INCLUDED
10 #define BOOST_TT_has_minus_assign_ASSIGN_HPP_INCLUDED
11
12 #include <boost/config.hpp>
13 #include <boost/type_traits/detail/config.hpp>
14
15 // cannot include this header without getting warnings of the kind:
16 // gcc:
17 // warning: value computed is not used
18 // warning: comparison between signed and unsigned integer expressions
19 // msvc:
20 // warning C4018: '<' : signed/unsigned mismatch
21 // warning C4244: '+=' : conversion from 'double' to 'char', possible loss of data
22 // warning C4547: '*' : operator before comma has no effect; expected operator with side-effect
23 // warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
24 // warning C4804: '<' : unsafe use of type 'bool' in operation
25 // warning C4805: '==' : unsafe mix of type 'bool' and type 'char' in operation
26 // cannot find another implementation -> declared as system header to suppress these warnings.
27 #if defined(__GNUC__)
28 # pragma GCC system_header
29 #elif defined(BOOST_MSVC)
30 # pragma warning ( push )
31 # pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 4133)
32 # if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
33 # pragma warning ( disable : 6334)
34 # endif
35 #endif
36
37 #if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION)
38
39 #include <boost/type_traits/integral_constant.hpp>
40 #include <boost/type_traits/make_void.hpp>
41 #include <boost/type_traits/is_convertible.hpp>
42 #include <boost/type_traits/is_void.hpp>
43 #include <boost/type_traits/is_pointer.hpp>
44 #include <boost/type_traits/add_reference.hpp>
45 #include <boost/type_traits/remove_pointer.hpp>
46 #include <boost/type_traits/remove_reference.hpp>
47 #include <utility>
48
49 namespace boost
50 {
51
52 namespace binary_op_detail {
53
54 struct dont_care;
55
56 template <class T, class U, class Ret, class = boost::void_t<>>
57 struct has_minus_assign_ret_imp : public boost::false_type {};
58
59 template <class T, class U, class Ret>
60 struct has_minus_assign_ret_imp<T, U, Ret, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() -= std::declval<typename add_reference<U>::type>())> >
61 : 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> {};
62
63 template <class T, class U, class = boost::void_t<> >
64 struct has_minus_assign_void_imp : public boost::false_type {};
65
66 template <class T, class U>
67 struct has_minus_assign_void_imp<T, U, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() -= std::declval<typename add_reference<U>::type>())> >
68 : public boost::integral_constant<bool, ::boost::is_void<decltype(std::declval<typename add_reference<T>::type>() -= std::declval<typename add_reference<U>::type>())>::value> {};
69
70 template <class T, class U, class = boost::void_t<>>
71 struct has_minus_assign_dc_imp : public boost::false_type {};
72
73 template <class T, class U>
74 struct has_minus_assign_dc_imp<T, U, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() -= std::declval<typename add_reference<U>::type>())> >
75 : public boost::true_type {};
76
77 template <class T, class U, class Ret>
78 struct has_minus_assign_ret_filter : public boost::binary_op_detail::has_minus_assign_ret_imp <T, U, Ret> {};
79 template <class T, class U>
80 struct has_minus_assign_ret_filter<T, U, void> : public boost::binary_op_detail::has_minus_assign_void_imp <T, U> {};
81 template <class T, class U>
82 struct has_minus_assign_ret_filter<T, U, boost::binary_op_detail::dont_care> : public boost::binary_op_detail::has_minus_assign_dc_imp <T, U> {};
83
84 template <class T, class U, class Ret, bool b>
85 struct has_minus_assign_void_ptr_filter : public boost::binary_op_detail::has_minus_assign_ret_filter <T, U, Ret> {};
86 template <class T, class U, class Ret>
87 struct has_minus_assign_void_ptr_filter<T, U, Ret, true> : public boost::false_type {};
88
89 }
90
91 template <class T, class U = T, class Ret = boost::binary_op_detail::dont_care>
92 struct has_minus_assign :
93 public boost::binary_op_detail::has_minus_assign_void_ptr_filter<
94 T, U, Ret,
95 boost::is_void<typename remove_pointer<typename remove_reference<T>::type>::type>::value
96 || boost::is_void<typename remove_pointer<typename remove_reference<U>::type>::type>::value
97 || (boost::is_pointer<typename remove_reference<T>::type>::value && boost::is_pointer<typename remove_reference<U>::type>::value)> {};
98
99
100 }
101
102 #else
103
104 #define BOOST_TT_TRAIT_NAME has_minus_assign
105 #define BOOST_TT_TRAIT_OP -=
106 #define BOOST_TT_FORBIDDEN_IF\
107 (\
108 /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\
109 (\
110 ::boost::is_pointer< Lhs_noref >::value && \
111 ::boost::is_fundamental< Rhs_nocv >::value && \
112 (! ::boost::is_integral< Rhs_noref >::value )\
113 ) || \
114 /* Lhs==void* and Rhs==fundamental */\
115 (\
116 ::boost::is_pointer< Lhs_noref >::value && \
117 ::boost::is_void< Lhs_noptr >::value && \
118 ::boost::is_fundamental< Rhs_nocv >::value\
119 ) || \
120 /* Rhs==void* and Lhs==fundamental */\
121 (\
122 ::boost::is_pointer< Rhs_noref >::value && \
123 ::boost::is_void< Rhs_noptr >::value && \
124 ::boost::is_fundamental< Lhs_nocv >::value\
125 ) || \
126 /* Lhs=fundamental and Rhs=pointer */\
127 (\
128 ::boost::is_fundamental< Lhs_nocv >::value && \
129 ::boost::is_pointer< Rhs_noref >::value\
130 ) || \
131 /* Lhs==pointer and Rhs==pointer */\
132 (\
133 ::boost::is_pointer< Lhs_noref >::value && \
134 ::boost::is_pointer< Rhs_noref >::value\
135 ) || \
136 /* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\
137 (\
138 (\
139 ::boost::is_fundamental< Lhs_nocv >::value || \
140 ::boost::is_pointer< Lhs_noref >::value\
141 ) && \
142 (\
143 ::boost::is_fundamental< Rhs_nocv >::value || \
144 ::boost::is_pointer< Rhs_noref >::value\
145 ) && \
146 ::boost::is_const< Lhs_noref >::value\
147 )\
148 )
149
150
151 #include <boost/type_traits/detail/has_binary_operator.hpp>
152
153 #undef BOOST_TT_TRAIT_NAME
154 #undef BOOST_TT_TRAIT_OP
155 #undef BOOST_TT_FORBIDDEN_IF
156
157 #endif
158 #endif