|
| 1 | +///////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// (C) Copyright Ion Gaztanaga 2025-2025 |
| 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/intrusive for documentation. |
| 10 | +// |
| 11 | +///////////////////////////////////////////////////////////////////////////// |
| 12 | + |
| 13 | +#include <boost/config.hpp> |
| 14 | + |
| 15 | +//Conditional triviality is based on destructor overloads based on concepts |
| 16 | +#if defined(BOOST_INTRUSIVE_CONCEPTS_BASED_OVERLOADING) |
| 17 | + |
| 18 | +#include <type_traits> |
| 19 | + |
| 20 | +#include <boost/intrusive/list.hpp> |
| 21 | +#include <boost/intrusive/slist.hpp> |
| 22 | +#include <boost/intrusive/set.hpp> |
| 23 | +#include <boost/intrusive/unordered_set.hpp> |
| 24 | +#include <boost/intrusive/splay_set.hpp> |
| 25 | +#include <boost/intrusive/avl_set.hpp> |
| 26 | +#include <boost/intrusive/sg_set.hpp> |
| 27 | +#include <boost/intrusive/treap_set.hpp> |
| 28 | +#include <boost/intrusive/bs_set.hpp> |
| 29 | +#include <boost/intrusive/pointer_traits.hpp> |
| 30 | +#include <boost/intrusive/any_hook.hpp> |
| 31 | + |
| 32 | +using namespace boost::intrusive; |
| 33 | + |
| 34 | +typedef list_base_hook |
| 35 | + < void_pointer<void*>, link_mode<normal_link> > list_base_hook_t; |
| 36 | +typedef slist_base_hook |
| 37 | + < void_pointer<void*>, link_mode<normal_link> > slist_base_hook_t; |
| 38 | +typedef set_base_hook |
| 39 | + < void_pointer<void*>, link_mode<normal_link> > set_base_hook_t; |
| 40 | +typedef avl_set_base_hook |
| 41 | + < void_pointer<void*>, link_mode<normal_link> > avl_base_hook_t; |
| 42 | +typedef bs_set_base_hook |
| 43 | + < void_pointer<void*>, link_mode<normal_link> > bs_base_hook_t; |
| 44 | +typedef unordered_set_base_hook |
| 45 | + < void_pointer<void*>, link_mode<normal_link> > unordered_base_hook_t; |
| 46 | +typedef any_base_hook |
| 47 | + < void_pointer<void*>, link_mode<normal_link> > any_base_hook_t; |
| 48 | + |
| 49 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<list_base_hook_t> )); |
| 50 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<slist_base_hook_t> )); |
| 51 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<set_base_hook_t> )); |
| 52 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<avl_base_hook_t> )); |
| 53 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<bs_base_hook_t> )); |
| 54 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<unordered_base_hook_t> )); |
| 55 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<any_base_hook_t> )); |
| 56 | + |
| 57 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<list_base_hook_t> )); |
| 58 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<slist_base_hook_t> )); |
| 59 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<set_base_hook_t> )); |
| 60 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<avl_base_hook_t> )); |
| 61 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<bs_base_hook_t> )); |
| 62 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<unordered_base_hook_t> )); |
| 63 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<any_base_hook_t> )); |
| 64 | + |
| 65 | +typedef list_member_hook |
| 66 | + < void_pointer<void*>, link_mode<normal_link> > list_member_hook_t; |
| 67 | +typedef slist_member_hook |
| 68 | + < void_pointer<void*>, link_mode<normal_link> > slist_member_hook_t; |
| 69 | +typedef set_member_hook |
| 70 | + < void_pointer<void*>, link_mode<normal_link> > set_member_hook_t; |
| 71 | +typedef avl_set_member_hook |
| 72 | + < void_pointer<void*>, link_mode<normal_link> > avl_member_hook_t; |
| 73 | +typedef bs_set_member_hook |
| 74 | + < void_pointer<void*>, link_mode<normal_link> > bs_member_hook_t; |
| 75 | +typedef unordered_set_member_hook |
| 76 | + < void_pointer<void*>, link_mode<normal_link> > unordered_member_hook_t; |
| 77 | +typedef any_member_hook |
| 78 | + < void_pointer<void*>, link_mode<normal_link> > any_member_hook_t; |
| 79 | + |
| 80 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<list_member_hook_t> )); |
| 81 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<slist_member_hook_t> )); |
| 82 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<set_member_hook_t> )); |
| 83 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<avl_member_hook_t> )); |
| 84 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<bs_member_hook_t> )); |
| 85 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<unordered_member_hook_t> )); |
| 86 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<any_member_hook_t> )); |
| 87 | + |
| 88 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<list_member_hook_t> )); |
| 89 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<slist_member_hook_t> )); |
| 90 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<set_member_hook_t> )); |
| 91 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<avl_member_hook_t> )); |
| 92 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<bs_member_hook_t> )); |
| 93 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<unordered_member_hook_t> )); |
| 94 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_default_constructible_v<any_member_hook_t> )); |
| 95 | + |
| 96 | +struct MyType |
| 97 | + : public list_base_hook_t |
| 98 | + , public slist_base_hook_t |
| 99 | + , public set_base_hook_t |
| 100 | + , public avl_base_hook_t |
| 101 | + , public bs_base_hook_t |
| 102 | + , public unordered_base_hook_t |
| 103 | + , public any_base_hook_t |
| 104 | +{ |
| 105 | + list_member_hook_t limh; |
| 106 | + slist_member_hook_t slmh; |
| 107 | + set_member_hook_t semh; |
| 108 | + avl_member_hook_t avmh; |
| 109 | + bs_member_hook_t bsmh; |
| 110 | + unordered_member_hook_t unmh; |
| 111 | + any_member_hook_t anmh; |
| 112 | + |
| 113 | + friend bool operator<(const MyType &, const MyType &) { return true; } |
| 114 | + friend std::size_t hash_value(const MyType &, const MyType &) { return 0u; } |
| 115 | +}; |
| 116 | + |
| 117 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<MyType> )); |
| 118 | + |
| 119 | +typedef list<MyType> list_t; |
| 120 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<list_t> )); |
| 121 | + |
| 122 | +typedef slist<MyType> slist_t; |
| 123 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<slist_t> )); |
| 124 | + |
| 125 | +typedef set<MyType> set_t; |
| 126 | +typedef multiset<MyType> multiset_t; |
| 127 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<set_t> )); |
| 128 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<multiset_t> )); |
| 129 | + |
| 130 | +typedef avl_set<MyType> avl_set_t; |
| 131 | +typedef avl_multiset<MyType> avl_multiset_t; |
| 132 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<avl_set_t> )); |
| 133 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<avl_multiset_t> )); |
| 134 | + |
| 135 | +typedef bs_set<MyType> bs_set_t; |
| 136 | +typedef bs_multiset<MyType> bs_multiset_t; |
| 137 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<bs_set_t> )); |
| 138 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<bs_multiset_t> )); |
| 139 | + |
| 140 | +typedef sg_set<MyType> sg_set_t; |
| 141 | +typedef sg_multiset<MyType> sg_multiset_t; |
| 142 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<sg_set_t> )); |
| 143 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<sg_multiset_t> )); |
| 144 | + |
| 145 | +typedef treap_set<MyType> treap_set_t; |
| 146 | +typedef treap_multiset<MyType> treap_multiset_t; |
| 147 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<treap_set_t> )); |
| 148 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<treap_multiset_t> )); |
| 149 | + |
| 150 | +typedef treap_set<MyType> treap_set_t; |
| 151 | +typedef treap_multiset<MyType> treap_multiset_t; |
| 152 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<treap_set_t> )); |
| 153 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<treap_multiset_t> )); |
| 154 | + |
| 155 | +typedef unordered_set<MyType> unordered_set_t; |
| 156 | +typedef unordered_multiset<MyType> unordered_multiset_t; |
| 157 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<unordered_set_t> )); |
| 158 | +BOOST_INTRUSIVE_STATIC_ASSERT(( std::is_trivially_destructible_v<unordered_multiset_t> )); |
| 159 | + |
| 160 | +int main() |
| 161 | +{ |
| 162 | + return 0; |
| 163 | +} |
| 164 | + |
| 165 | +#else |
| 166 | + |
| 167 | +int main() |
| 168 | +{ |
| 169 | + return 0; |
| 170 | +} |
| 171 | + |
| 172 | +#endif |
0 commit comments