1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2015-2015.
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// See http://www.boost.org/libs/move for documentation.
10//
11//////////////////////////////////////////////////////////////////////////////
12#include <boost/move/detail/type_traits.hpp>
13#include <boost/move/core.hpp>
14#include <boost/core/lightweight_test.hpp>
15
16//
17// pod_struct
18//
19#if defined(BOOST_MOVE_IS_POD)
20struct pod_struct
21{
22 int i;
23 float f;
24};
25#endif
26
27//
28// deleted_copy_and_assign_type
29//
30#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
31
32struct deleted_copy_and_assign_type
33{
34 deleted_copy_and_assign_type(const deleted_copy_and_assign_type&) = delete;
35 deleted_copy_and_assign_type & operator=(const deleted_copy_and_assign_type&) = delete;
36};
37
38#endif //defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
39
40//
41// boost_move_type
42//
43class boost_move_type
44{
45 BOOST_MOVABLE_BUT_NOT_COPYABLE(boost_move_type)
46 public:
47 boost_move_type(BOOST_RV_REF(boost_move_type)){}
48 boost_move_type & operator=(BOOST_RV_REF(boost_move_type)){ return *this; }
49};
50
51namespace is_pod_test
52{
53
54void test()
55{
56 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_pod<int>::value));
57 #if defined(BOOST_MOVE_IS_POD)
58 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_pod<pod_struct>::value));
59 #endif
60}
61
62} //namespace is_pod_test
63
64namespace trivially_memcopyable_test {
65
66void test()
67{
68 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
69 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<deleted_copy_and_assign_type>::value));
70 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<deleted_copy_and_assign_type>::value));
71 #endif //#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
72 //boost_move_type
73 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_constructible<boost_move_type>::value));
74 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_trivially_copy_assignable<boost_move_type>::value));
75 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_constructible<boost_move_type>::value));
76 BOOST_MOVE_STATIC_ASSERT(!(boost::move_detail::is_copy_assignable<boost_move_type>::value));
77 //POD
78 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<int>::value));
79 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<int>::value));
80 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_constructible<int>::value));
81 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_assignable<int>::value));
82 #if defined(BOOST_MOVE_IS_POD)
83 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_constructible<pod_struct>::value));
84 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_trivially_copy_assignable<pod_struct>::value));
85 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_constructible<pod_struct>::value));
86 BOOST_MOVE_STATIC_ASSERT((boost::move_detail::is_copy_assignable<pod_struct>::value));
87 #endif
88}
89
90} //namespace trivially_memcopyable_test {
91
92int main()
93{
94 trivially_memcopyable_test::test();
95 is_pod_test::test();
96 boost::report_errors();
97}
98

source code of boost/libs/move/test/type_traits.cpp