1
2// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6//
7// See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9#ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED
10#define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED
11
12#include <boost/type_traits/intrinsics.hpp>
13#include <boost/type_traits/integral_constant.hpp>
14
15#ifdef BOOST_HAS_NOTHROW_COPY
16
17#if defined(BOOST_CLANG) || defined(__GNUC__) || defined(__ghs__) || defined(__CODEGEARC__) || defined(__SUNPRO_CC)
18#include <boost/type_traits/is_volatile.hpp>
19#include <boost/type_traits/is_copy_constructible.hpp>
20#include <boost/type_traits/is_reference.hpp>
21#include <boost/type_traits/is_array.hpp>
22#ifdef BOOST_INTEL
23#include <boost/type_traits/is_pod.hpp>
24#endif
25#elif defined(BOOST_MSVC) || defined(BOOST_INTEL)
26#include <boost/type_traits/has_trivial_copy.hpp>
27#include <boost/type_traits/is_array.hpp>
28#ifdef BOOST_INTEL
29#include <boost/type_traits/add_lvalue_reference.hpp>
30#include <boost/type_traits/add_const.hpp>
31#endif
32#endif
33
34namespace boost {
35
36template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_COPY(T)>{};
37
38#elif !defined(BOOST_NO_CXX11_NOEXCEPT)
39
40#include <boost/type_traits/declval.hpp>
41#include <boost/type_traits/is_copy_constructible.hpp>
42
43namespace boost{
44
45namespace detail{
46
47template <class T, bool b>
48struct has_nothrow_copy_constructor_imp : public boost::integral_constant<bool, false>{};
49template <class T>
50struct has_nothrow_copy_constructor_imp<T, true> : public boost::integral_constant<bool, noexcept(T(boost::declval<const T&>()))>{};
51
52}
53
54template <class T> struct has_nothrow_copy_constructor : public detail::has_nothrow_copy_constructor_imp<T, boost::is_copy_constructible<T>::value>{};
55
56#else
57
58#include <boost/type_traits/has_trivial_copy.hpp>
59
60namespace boost{
61
62template <class T> struct has_nothrow_copy_constructor : public integral_constant<bool, ::boost::has_trivial_copy<T>::value>{};
63
64#endif
65
66template <> struct has_nothrow_copy_constructor<void> : public false_type{};
67template <class T> struct has_nothrow_copy_constructor<T volatile> : public false_type{};
68template <class T> struct has_nothrow_copy_constructor<T&> : public false_type{};
69#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
70template <class T> struct has_nothrow_copy_constructor<T&&> : public false_type{};
71#endif
72#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
73template <> struct has_nothrow_copy_constructor<void const> : public false_type{};
74template <> struct has_nothrow_copy_constructor<void volatile> : public false_type{};
75template <> struct has_nothrow_copy_constructor<void const volatile> : public false_type{};
76#endif
77
78template <class T> struct has_nothrow_copy : public has_nothrow_copy_constructor<T>{};
79
80} // namespace boost
81
82#endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED
83

source code of boost/boost/type_traits/has_nothrow_copy.hpp