mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 05:54:38 +02:00
any_xxx_node_traits must return pointers by value to avoid aliasing problems, as done long time ago with other traits.
This commit is contained in:
@@ -47,13 +47,13 @@ struct any_list_node_traits
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_next(const const_node_ptr & n)
|
||||
static 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)
|
||||
static 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)
|
||||
@@ -68,7 +68,7 @@ struct any_slist_node_traits
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_next(const const_node_ptr & n)
|
||||
static 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)
|
||||
@@ -88,7 +88,7 @@ struct any_unordered_node_traits
|
||||
static const bool store_hash = true;
|
||||
static const bool optimize_multikey = true;
|
||||
|
||||
static const node_ptr &get_next(const const_node_ptr & n)
|
||||
static 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)
|
||||
@@ -117,19 +117,19 @@ struct any_rbtree_node_traits
|
||||
|
||||
typedef std::size_t color;
|
||||
|
||||
static const node_ptr &get_parent(const const_node_ptr & n)
|
||||
static 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)
|
||||
static 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)
|
||||
static 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)
|
||||
@@ -158,19 +158,19 @@ struct any_avltree_node_traits
|
||||
|
||||
typedef std::size_t balance;
|
||||
|
||||
static const node_ptr &get_parent(const const_node_ptr & n)
|
||||
static 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)
|
||||
static 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)
|
||||
static 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)
|
||||
@@ -200,19 +200,19 @@ struct any_tree_node_traits
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_parent(const const_node_ptr & n)
|
||||
static 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)
|
||||
static 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)
|
||||
static 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)
|
||||
|
Reference in New Issue
Block a user