/usr/include/boost/intrusive/detail/any_node_and_algorithms.hpp is in libboost1.55-dev 1.55.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | /////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-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/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_ANY_NODE_HPP
#define BOOST_INTRUSIVE_ANY_NODE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <iterator>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <cstddef>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/pointer_cast.hpp>
namespace boost {
namespace intrusive {
template<class VoidPointer>
struct any_node
{
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<any_node>::type node_ptr;
node_ptr node_ptr_1;
node_ptr node_ptr_2;
node_ptr node_ptr_3;
std::size_t size_t_1;
};
template<class VoidPointer>
struct any_list_node_traits
{
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
static const node_ptr &get_next(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; }
static const node_ptr &get_previous(const const_node_ptr & n)
{ return n->node_ptr_2; }
static void set_previous(const node_ptr & n, const node_ptr & prev)
{ n->node_ptr_2 = prev; }
};
template<class VoidPointer>
struct any_slist_node_traits
{
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
static const node_ptr &get_next(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; }
};
template<class VoidPointer>
struct any_unordered_node_traits
: public any_slist_node_traits<VoidPointer>
{
typedef any_slist_node_traits<VoidPointer> reduced_slist_node_traits;
typedef typename reduced_slist_node_traits::node node;
typedef typename reduced_slist_node_traits::node_ptr node_ptr;
typedef typename reduced_slist_node_traits::const_node_ptr const_node_ptr;
static const bool store_hash = true;
static const bool optimize_multikey = true;
static const node_ptr &get_next(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; }
static node_ptr get_prev_in_group(const const_node_ptr & n)
{ return n->node_ptr_2; }
static void set_prev_in_group(const node_ptr & n, const node_ptr & prev)
{ n->node_ptr_2 = prev; }
static std::size_t get_hash(const const_node_ptr & n)
{ return n->size_t_1; }
static void set_hash(const node_ptr & n, std::size_t h)
{ n->size_t_1 = h; }
};
template<class VoidPointer>
struct any_rbtree_node_traits
{
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
typedef std::size_t color;
static const node_ptr &get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; }
static const node_ptr &get_left(const const_node_ptr & n)
{ return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; }
static const node_ptr &get_right(const const_node_ptr & n)
{ return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; }
static color get_color(const const_node_ptr & n)
{ return n->size_t_1; }
static void set_color(const node_ptr & n, color c)
{ n->size_t_1 = c; }
static color black()
{ return 0u; }
static color red()
{ return 1u; }
};
template<class VoidPointer>
struct any_avltree_node_traits
{
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
typedef std::size_t balance;
static const node_ptr &get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; }
static const node_ptr &get_left(const const_node_ptr & n)
{ return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; }
static const node_ptr &get_right(const const_node_ptr & n)
{ return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; }
static balance get_balance(const const_node_ptr & n)
{ return n->size_t_1; }
static void set_balance(const node_ptr & n, balance b)
{ n->size_t_1 = b; }
static balance negative()
{ return 0u; }
static balance zero()
{ return 1u; }
static balance positive()
{ return 2u; }
};
template<class VoidPointer>
struct any_tree_node_traits
{
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
static const node_ptr &get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; }
static const node_ptr &get_left(const const_node_ptr & n)
{ return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; }
static const node_ptr &get_right(const const_node_ptr & n)
{ return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; }
};
template<class VoidPointer>
class any_node_traits
{
public:
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
};
template<class VoidPointer>
class any_algorithms
{
template <class T>
static void function_not_available_for_any_hooks(typename detail::enable_if<detail::is_same<T, bool> >::type)
{}
public:
typedef any_node<VoidPointer> node;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
typedef any_node_traits<VoidPointer> node_traits;
//! <b>Requires</b>: node must not be part of any tree.
//!
//! <b>Effects</b>: After the function unique(node) == true.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
static void init(const node_ptr & node)
{ node->node_ptr_1 = 0; };
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: Nothing.
static bool inited(const const_node_ptr & node)
{ return !node->node_ptr_1; };
static bool unique(const const_node_ptr & node)
{ return 0 == node->node_ptr_1; }
static void unlink(const node_ptr &)
{
//Auto-unlink hooks and unlink() are not available for any hooks
any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
}
static void swap_nodes(const node_ptr & l, const node_ptr & r)
{
//Any nodes have no swap_nodes capability because they don't know
//what algorithm they must use to unlink the node from the container
any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
}
};
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_ANY_NODE_HPP
|