summaryrefslogtreecommitdiff
path: root/boost/type_traits/detail/has_binary_operator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_traits/detail/has_binary_operator.hpp')
-rw-r--r--boost/type_traits/detail/has_binary_operator.hpp85
1 files changed, 71 insertions, 14 deletions
diff --git a/boost/type_traits/detail/has_binary_operator.hpp b/boost/type_traits/detail/has_binary_operator.hpp
index 039a6bb778..ec6e52e73b 100644
--- a/boost/type_traits/detail/has_binary_operator.hpp
+++ b/boost/type_traits/detail/has_binary_operator.hpp
@@ -7,19 +7,7 @@
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#include <boost/config.hpp>
-#include <boost/type_traits/detail/yes_no_type.hpp>
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/is_base_of.hpp>
-#include <boost/type_traits/is_const.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/type_traits/is_fundamental.hpp>
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_void.hpp>
-#include <boost/type_traits/remove_cv.hpp>
-#include <boost/type_traits/remove_pointer.hpp>
-#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/detail/config.hpp>
// cannot include this header without getting warnings of the kind:
// gcc:
@@ -37,12 +25,78 @@
# pragma GCC system_header
#elif defined(BOOST_MSVC)
# pragma warning ( push )
-# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913)
+# 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/add_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 BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {};
+
+ template <class T, class U, class Ret>
+ struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)<T, U, Ret, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() BOOST_TT_TRAIT_OP std::declval<typename add_reference<U>::type>())> >
+ : public boost::integral_constant<bool, ::boost::is_convertible<decltype(std::declval<typename add_reference<T>::type>() BOOST_TT_TRAIT_OP std::declval<typename add_reference<U>::type>()), Ret>::value> {};
+
+ template <class T, class U, class = boost::void_t<> >
+ struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {};
+
+ template <class T, class U>
+ struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)<T, U, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() BOOST_TT_TRAIT_OP std::declval<typename add_reference<U>::type>())> >
+ : public boost::integral_constant<bool, ::boost::is_void<decltype(std::declval<typename add_reference<T>::type>() BOOST_TT_TRAIT_OP std::declval<typename add_reference<U>::type>())>::value> {};
+
+ template <class T, class U, class = boost::void_t<>>
+ struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {};
+
+ template <class T, class U>
+ struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)<T, U, boost::void_t<decltype(std::declval<typename add_reference<T>::type>() BOOST_TT_TRAIT_OP std::declval<typename add_reference<U>::type>())> >
+ : public boost::true_type {};
+
+ }
+
+ template <class T, class U = T, class Ret = boost::binary_op_detail::dont_care>
+ struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail:: BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) <T, U, Ret> {};
+ template <class T, class U>
+ struct BOOST_TT_TRAIT_NAME<T, U, void> : public boost::binary_op_detail:: BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) <T, U> {};
+ template <class T, class U>
+ struct BOOST_TT_TRAIT_NAME<T, U, boost::binary_op_detail::dont_care> : public boost::binary_op_detail:: BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) <T, U> {};
+
+
+}
+
+#else
+
+#include <boost/type_traits/detail/yes_no_type.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_fundamental.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/detail/is_likely_lambda.hpp>
+
namespace boost {
namespace detail {
@@ -217,6 +271,9 @@ struct BOOST_TT_TRAIT_NAME : public integral_constant<bool, (::boost::detail::BO
} // namespace boost
+#endif
+
#if defined(BOOST_MSVC)
# pragma warning ( pop )
#endif
+