diff --git a/include/boost/intrusive/bstree_algorithms.hpp b/include/boost/intrusive/bstree_algorithms.hpp index ebbe3df..febace9 100644 --- a/include/boost/intrusive/bstree_algorithms.hpp +++ b/include/boost/intrusive/bstree_algorithms.hpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2007-2014 +// (C) Copyright Daniel Steck 2021 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -413,7 +414,8 @@ class bstree_algorithms : public bstree_algorithms_base //Finally adjust parent nodes if ((temp = NodeTraits::get_parent(node1)) == NodeTraits::get_parent(node2)) { - auto left = NodeTraits::get_left(temp); + // special logic for the case where the nodes are siblings + const node_ptr left = NodeTraits::get_left(temp); NodeTraits::set_left(temp, NodeTraits::get_right(temp)); NodeTraits::set_right(temp, left); } else { diff --git a/test/swap_nodes_test.cpp b/test/swap_nodes_test.cpp index 39052de..13a17af 100644 --- a/test/swap_nodes_test.cpp +++ b/test/swap_nodes_test.cpp @@ -1,6 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// // -// Created by daniel on 27/04/2021. +// (C) Copyright Daniel Steck 2021 // +// 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. +// +///////////////////////////////////////////////////////////////////////////// #include #include