diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:33:54 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:36:09 +0900 |
commit | d9ec475d945d3035377a0d89ed42e382d8988891 (patch) | |
tree | 34aff2cee4b209906243ab5499d61f3edee2982f /boost/type_traits/has_nothrow_copy.hpp | |
parent | 71d216b90256936a9638f325af9bc69d720e75de (diff) | |
download | boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.gz boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.bz2 boost-d9ec475d945d3035377a0d89ed42e382d8988891.zip |
Imported Upstream version 1.60.0
Change-Id: Ie709530d6d5841088ceaba025cbe175a4ef43050
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/type_traits/has_nothrow_copy.hpp')
-rw-r--r-- | boost/type_traits/has_nothrow_copy.hpp | 75 |
1 files changed, 52 insertions, 23 deletions
diff --git a/boost/type_traits/has_nothrow_copy.hpp b/boost/type_traits/has_nothrow_copy.hpp index 9c3c9030a4..0d9bb18379 100644 --- a/boost/type_traits/has_nothrow_copy.hpp +++ b/boost/type_traits/has_nothrow_copy.hpp @@ -9,45 +9,74 @@ #ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED -#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_NOTHROW_COPY -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> +#if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) || defined(__SUNPRO_CC) +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_copy_constructible.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_array.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/is_pod.hpp> +#endif +#elif defined(BOOST_MSVC) || defined(BOOST_INTEL) +#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/is_array.hpp> +#ifdef BOOST_INTEL +#include <boost/type_traits/add_lvalue_reference.hpp> +#include <boost/type_traits/add_const.hpp> +#endif +#endif namespace boost { +template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_COPY(T)>{}; + +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) + +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_copy_constructible.hpp> + +namespace boost{ + namespace detail{ +template <class T, bool b> +struct has_nothrow_copy_constructor_imp : public boost::integral_constant<bool, false>{}; template <class T> -struct has_nothrow_copy_imp{ -#ifdef BOOST_HAS_NOTHROW_COPY - BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_COPY(T)); -#else - BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_copy<T>::value); -#endif -}; +struct has_nothrow_copy_constructor_imp<T, true> : public boost::integral_constant<bool, noexcept(T(boost::declval<const T&>()))>{}; } -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp<T>::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy_constructor,T,::boost::detail::has_nothrow_copy_imp<T>::value) +template <class T> struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp<T, boost::is_copy_constructible<T>::value>{}; + +#else + +#include <boost/type_traits/has_trivial_copy.hpp> + +namespace boost{ + +template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, ::boost::has_trivial_copy<T>::value>{}; -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void volatile,false) #endif -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void,false) +template <> struct has_nothrow_copy_constructor<void> : public false_type{}; +template <class T> struct has_nothrow_copy_constructor<T volatile> : public false_type{}; +template <class T> struct has_nothrow_copy_constructor<T&> : public false_type{}; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template <class T> struct has_nothrow_copy_constructor<T&&> : public false_type{}; +#endif #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void volatile,false) +template <> struct has_nothrow_copy_constructor<void const> : public false_type{}; +template <> struct has_nothrow_copy_constructor<void volatile> : public false_type{}; +template <> struct has_nothrow_copy_constructor<void const volatile> : public false_type{}; #endif -} // namespace boost +template <class T> struct has_nothrow_copy : public has_nothrow_copy_constructor<T>{}; -#include <boost/type_traits/detail/bool_trait_undef.hpp> +} // namespace boost #endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED |