diff --git a/include/boost/type_traits/detail/decl.hpp b/include/boost/type_traits/detail/decl.hpp new file mode 100644 index 0000000..a8953c6 --- /dev/null +++ b/include/boost/type_traits/detail/decl.hpp @@ -0,0 +1,29 @@ + +// (C) Copyright John Maddock 2015. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_DETAIL_DECL_HEADER +#define BOOST_TT_DETAIL_DECL_HEADER + +#include +#include +#include +#include + +namespace boost { namespace detail{ + +template +typename add_rvalue_reference::type tt_declval() BOOST_NOEXCEPT; // as unevaluated operand +template +typename add_lvalue_reference::type const>::type tt_decl_const_ref() BOOST_NOEXCEPT; // as unevaluated operand +template +typename add_lvalue_reference::type>::type tt_decl_ref() BOOST_NOEXCEPT; // as unevaluated operand + + +}} // namespace boost + +#endif // BOOST_TT_DETAIL_DECL_HEADER diff --git a/include/boost/type_traits/has_nothrow_assign.hpp b/include/boost/type_traits/has_nothrow_assign.hpp index 0c88c00..c337fd6 100644 --- a/include/boost/type_traits/has_nothrow_assign.hpp +++ b/include/boost/type_traits/has_nothrow_assign.hpp @@ -14,6 +14,12 @@ #if !defined(BOOST_HAS_NOTHROW_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL) #include +#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#include +#include +#include +#include +#endif #endif #if defined(__GNUC__) || defined(__SUNPRO_CC) #include @@ -25,10 +31,27 @@ namespace boost { +#if !defined(BOOST_HAS_NOTHROW_ASSIGN) && !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + namespace detail + { + template struct has_nothrow_assign_imp{ static const bool value = false; }; + template struct has_nothrow_assign_imp{ static const bool value = noexcept(detail::tt_decl_ref() = detail::tt_decl_const_ref()); }; + template struct has_nothrow_assign_imp{ static const bool value = has_nothrow_assign_imp::value; }; + template struct has_nothrow_assign_imp{ static const bool value = has_nothrow_assign_imp::value; }; + } + +#endif + template struct has_nothrow_assign : public integral_constant::type>::value || is_volatile::type>::value || is_reference::value>::value +#else ::boost::has_trivial_assign::value +#endif #else BOOST_HAS_NOTHROW_ASSIGN(T) #endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 0a8d268..0c9d4a3 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -29,6 +29,10 @@ rule all-tests { { result += [ run $(source) ] ; } + for local source in has_nothrow_assign_test + { + result += [ run $(source).cpp : : : BOOST_TT_DISABLE_INTRINSICS : $(source)_no_intrinsics ] ; + } return $(result) ; }