diff --git a/include/boost/multi_index/detail/rnd_index_ops.hpp b/include/boost/multi_index/detail/rnd_index_ops.hpp index 27b8aeb..5bf1ade 100644 --- a/include/boost/multi_index/detail/rnd_index_ops.hpp +++ b/include/boost/multi_index/detail/rnd_index_ops.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2008 Joaquin M Lopez Munoz. +/* Copyright 2003-2009 Joaquin M Lopez Munoz. * 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) @@ -174,6 +174,8 @@ void random_access_index_sort( * solution adopted. */ + if(ptrs.size()<=1)return; + typedef typename Node::value_type value_type; typedef typename Node::impl_pointer impl_pointer; typedef typename Node::impl_ptr_pointer impl_ptr_pointer; diff --git a/test/test_list_ops.cpp b/test/test_list_ops.cpp index 0bf0650..1748206 100644 --- a/test/test_list_ops.cpp +++ b/test/test_list_ops.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for standard list operations. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2009 Joaquin M Lopez Munoz. * 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) @@ -148,6 +148,15 @@ static void test_list_ops_unique_seq(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence)) si.merge(si2,std::greater()); BOOST_CHECK(is_sorted(si,std::greater())); BOOST_CHECK(si2.empty()); + + /* testcase for bug reported at + * https://svn.boost.org/trac/boost/ticket/3076 + */ + { + Sequence ss3; + sequenced_index &si3=get<1>(ss3); + si3.sort(); + } } template