4 // Copyright 2016 Peter Dimov
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
11 #include <boost/config.hpp>
13 #if defined( BOOST_NO_CXX11_HDR_TYPE_TRAITS )
21 #include <boost/shared_ptr.hpp>
22 #include <boost/shared_array.hpp>
23 #include <boost/weak_ptr.hpp>
24 #include <boost/enable_shared_from_this.hpp>
25 #include <boost/scoped_ptr.hpp>
26 #include <boost/scoped_array.hpp>
27 #include <boost/intrusive_ptr.hpp>
28 #include <boost/core/lightweight_test_trait.hpp>
29 #include <type_traits>
31 template<class T
> void test_copy()
33 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_copy_constructible
<T
> ));
34 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_copy_assignable
<T
> ));
37 template<class T
> void test_move()
39 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_move_constructible
<T
> ));
40 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_move_assignable
<T
> ));
43 template<class T
> void test_default()
45 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_default_constructible
<T
> ));
48 template<class T
> void test_destroy()
50 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_destructible
<T
> ));
53 template<class T
> void test_cmd()
64 struct Y
: public boost::enable_shared_from_this
<Y
>
70 test_cmd
< boost::shared_ptr
<X
> >();
71 test_cmd
< boost::shared_array
<X
> >();
72 test_cmd
< boost::weak_ptr
<X
> >();
79 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_move_constructible
<Y
> ));
81 #if !( defined( BOOST_MSVC ) && BOOST_MSVC == 1700 )
83 BOOST_TEST_TRAIT_TRUE(( std::is_nothrow_move_assignable
<Y
> ));
87 test_default
< boost::scoped_ptr
<X
> >();
88 test_default
< boost::scoped_array
<X
> >();
90 test_move
< boost::intrusive_ptr
<X
> >();
91 test_default
< boost::intrusive_ptr
<X
> >();
93 return boost::report_errors();
96 #endif // #if defined( BOOST_NO_CXX11_HDR_TYPE_TRAITS )