forked from boostorg/type_traits
Add new hooks for nothrow move assign/construct and fix is_nothrow_move_assignable and is_nothrow_move_constructible for msvc-12 and later.
This commit is contained in:
1 parent
c76c7cc1ad
commit
ffa9927732
11 files changed
+95
-19
No files matched your search
@@ -32,6 +32,8 @@
|
||||
// BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw
|
||||
// BOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw
|
||||
// BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor
|
||||
// BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) should evaluate to true if T has a non-throwing move constructor.
|
||||
// BOOST_IS_NOTHROW_MOVE_ASSIGN(T) should evaluate to true if T has a non-throwing move assignment operator.
|
||||
//
|
||||
// The following can also be defined: when detected our implementation is greatly simplified.
|
||||
//
|
||||
@@ -112,7 +114,10 @@
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || __is_pod(T)) && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || __is_pod(T)) && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value && !::boost::is_reference<T>::value)
|
||||
# endif
|
||||
|
||||
#if _MSC_FULL_VER < 180020827
|
||||
# define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&))
|
||||
# define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&))
|
||||
#endif
|
||||
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,23 @@ namespace boost {
|
||||
|
||||
namespace detail{
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
#ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN
|
||||
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp{ BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_ASSIGN(T)); };
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T const>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T volatile>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T const volatile>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T&>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
template <class T>
|
||||
struct is_nothrow_move_assignable_imp<T&&>{ BOOST_STATIC_CONSTANT(bool, value = false); };
|
||||
|
||||
|
||||
#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
|
||||
template <class T, class Enable = void>
|
||||
struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <boost/type_traits/has_trivial_move_constructor.hpp>
|
||||
#include <boost/type_traits/has_nothrow_copy.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
@@ -28,7 +29,25 @@ namespace boost {
|
||||
|
||||
namespace detail{
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
#ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT
|
||||
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp{
|
||||
BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp<volatile T> : public ::boost::false_type {};
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp<const volatile T> : public ::boost::false_type{};
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp<T&> : public ::boost::false_type{};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_imp<T&&> : public ::boost::false_type{};
|
||||
#endif
|
||||
|
||||
#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
|
||||
template <class T, class Enable = void>
|
||||
struct false_or_cpp11_noexcept_move_constructible: public ::boost::false_type {};
|
||||
|
||||
Reference in new issue
Block a user