summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/container/test/tree_test.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/container/test/tree_test.cpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/container/test/tree_test.cpp')
-rw-r--r--src/boost/libs/container/test/tree_test.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/src/boost/libs/container/test/tree_test.cpp b/src/boost/libs/container/test/tree_test.cpp
new file mode 100644
index 00000000..e0755967
--- /dev/null
+++ b/src/boost/libs/container/test/tree_test.cpp
@@ -0,0 +1,119 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#include <boost/container/detail/tree.hpp>
+#include <boost/container/adaptive_pool.hpp>
+#include <boost/container/new_allocator.hpp>
+#include <boost/move/traits.hpp>
+
+#include <iostream>
+
+#include "movable_int.hpp"
+#include "dummy_test_allocator.hpp"
+
+using namespace boost::container;
+
+typedef std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> pair_t;
+
+namespace boost {
+namespace container {
+
+//Explicit instantiation to detect compilation errors
+
+namespace dtl {
+
+//Instantiate base class as previous instantiations don't instantiate inherited members
+template class tree
+ < pair_t
+ , select1st<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , test::simple_allocator<pair_t>
+ , tree_assoc_defaults
+ >;
+
+template class tree
+ < pair_t
+ , select1st<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , std::allocator<pair_t>
+ , tree_assoc_defaults
+ >;
+
+template class tree
+ < pair_t
+ , select1st<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , adaptive_pool<pair_t>
+ , tree_assoc_defaults
+ >;
+
+template class tree
+ < test::movable_and_copyable_int
+ , identity<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , test::simple_allocator<test::movable_and_copyable_int>
+ , tree_assoc_defaults
+ >;
+
+template class tree
+ < test::movable_and_copyable_int
+ , identity<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , std::allocator<test::movable_and_copyable_int>
+ , tree_assoc_defaults
+ >;
+
+template class tree
+ < test::movable_and_copyable_int
+ , identity<test::movable_and_copyable_int>
+ , std::less<test::movable_and_copyable_int>
+ , adaptive_pool<test::movable_and_copyable_int>
+ , tree_assoc_defaults
+ >;
+
+} //dtl {
+
+}} //boost::container
+
+int main ()
+{
+ ////////////////////////////////////
+ // has_trivial_destructor_after_move testing
+ ////////////////////////////////////
+ // default
+ {
+ typedef boost::container::dtl::tree<int, void, std::less<int>, void, void> tree;
+ typedef tree::allocator_type allocator_type;
+ typedef boost::container::allocator_traits<allocator_type>::pointer pointer;
+ typedef tree::key_compare key_compare;
+ if (boost::has_trivial_destructor_after_move<tree>::value !=
+ boost::has_trivial_destructor_after_move<allocator_type>::value &&
+ boost::has_trivial_destructor_after_move<pointer>::value &&
+ boost::has_trivial_destructor_after_move<key_compare>::value) {
+ std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl;
+ return 1;
+ }
+ }
+ // std::allocator
+ {
+ typedef boost::container::dtl::tree<int, void, std::less<int>, std::allocator<int>, void> tree;
+ typedef tree::allocator_type allocator_type;
+ typedef boost::container::allocator_traits<allocator_type>::pointer pointer;
+ typedef tree::key_compare key_compare;
+ if (boost::has_trivial_destructor_after_move<tree>::value !=
+ boost::has_trivial_destructor_after_move<allocator_type>::value &&
+ boost::has_trivial_destructor_after_move<pointer>::value &&
+ boost::has_trivial_destructor_after_move<key_compare>::value) {
+ std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl;
+ return 1;
+ }
+ }
+
+ return 0;
+}