]> git.lyx.org Git - lyx.git/blobdiff - 3rdparty/boost/boost/type_traits/has_minus_assign.hpp
Update boost to 1.68.
[lyx.git] / 3rdparty / boost / boost / type_traits / has_minus_assign.hpp
index b53474e756ed1393e120b4c53b483f6c4ee5eb99..936ffedb4726e5e2f9583b98a63f80467e1cab5e 100644 (file)
@@ -6,8 +6,100 @@
 //
 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
 
-#ifndef BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
-#define BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
+#ifndef BOOST_TT_has_minus_assign_ASSIGN_HPP_INCLUDED
+#define BOOST_TT_has_minus_assign_ASSIGN_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/type_traits/detail/config.hpp>
+
+// cannot include this header without getting warnings of the kind:
+// gcc:
+//    warning: value computed is not used
+//    warning: comparison between signed and unsigned integer expressions
+// msvc:
+//    warning C4018: '<' : signed/unsigned mismatch
+//    warning C4244: '+=' : conversion from 'double' to 'char', possible loss of data
+//    warning C4547: '*' : operator before comma has no effect; expected operator with side-effect
+//    warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+//    warning C4804: '<' : unsafe use of type 'bool' in operation
+//    warning C4805: '==' : unsafe mix of type 'bool' and type 'char' in operation
+// cannot find another implementation -> declared as system header to suppress these warnings.
+#if defined(__GNUC__)
+#   pragma GCC system_header
+#elif defined(BOOST_MSVC)
+#   pragma warning ( push )
+#   pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 4133)
+#   if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
+#       pragma warning ( disable : 6334)
+#   endif
+#endif
+
+#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION)
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/make_void.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <utility>
+
+namespace boost
+{
+
+   namespace binary_op_detail {
+
+      struct dont_care;
+
+      template <class T, class U, class Ret, class = boost::void_t<>>
+      struct has_minus_assign_ret_imp : public boost::false_type {};
+
+      template <class T, class U, class Ret>
+      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>())> >
+         : 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> {};
+
+      template <class T, class U, class = boost::void_t<> >
+      struct has_minus_assign_void_imp : public boost::false_type {};
+
+      template <class T, class U>
+      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>())> >
+         : public boost::integral_constant<bool, ::boost::is_void<decltype(std::declval<typename add_reference<T>::type>() -= std::declval<typename add_reference<U>::type>())>::value> {};
+
+      template <class T, class U, class = boost::void_t<>>
+      struct has_minus_assign_dc_imp : public boost::false_type {};
+
+      template <class T, class U>
+      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>())> >
+         : public boost::true_type {};
+
+      template <class T, class U, class Ret>
+      struct has_minus_assign_ret_filter : public boost::binary_op_detail::has_minus_assign_ret_imp <T, U, Ret> {};
+      template <class T, class U>
+      struct has_minus_assign_ret_filter<T, U, void> : public boost::binary_op_detail::has_minus_assign_void_imp <T, U> {};
+      template <class T, class U>
+      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> {};
+
+      template <class T, class U, class Ret, bool b>
+      struct has_minus_assign_void_ptr_filter : public boost::binary_op_detail::has_minus_assign_ret_filter <T, U, Ret> {};
+      template <class T, class U, class Ret>
+      struct has_minus_assign_void_ptr_filter<T, U, Ret, true> : public boost::false_type {};
+
+   }
+
+   template <class T, class U = T, class Ret = boost::binary_op_detail::dont_care>
+   struct has_minus_assign :
+      public boost::binary_op_detail::has_minus_assign_void_ptr_filter<
+      T, U, Ret,
+      boost::is_void<typename remove_pointer<typename remove_reference<T>::type>::type>::value
+      || boost::is_void<typename remove_pointer<typename remove_reference<U>::type>::type>::value
+      || (boost::is_pointer<typename remove_reference<T>::type>::value && boost::is_pointer<typename remove_reference<U>::type>::value)> {};
+
+
+}
+
+#else
 
 #define BOOST_TT_TRAIT_NAME has_minus_assign
 #define BOOST_TT_TRAIT_OP -=
 #undef BOOST_TT_FORBIDDEN_IF
 
 #endif
+
+#if defined(BOOST_MSVC)
+#   pragma warning (pop)
+#endif
+
+#endif