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:
Ion Gaztañaga
2015-02-02 17:12:18 +01:00
parent 667ec0bdfc
commit b9aa032d98

View File

@@ -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)