diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 982e0db..51025cc 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -77,7 +77,6 @@ #if !defined(BOOST_NO_SFINAE) #include -#include #include #endif @@ -546,9 +545,8 @@ public: #if !defined(BOOST_NO_SFINAE) typename enable_if_c< - is_same< - typename remove_reference::type::node_type,node_type>::value&& - !is_const::type>::value + !is_const::value&& + is_same::value >::type #else void @@ -559,7 +557,7 @@ public: BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; - typedef typename remove_reference::type::iterator source_iterator; + typedef typename Index::iterator source_iterator; source_iterator first=x.begin(),last=x.end(); if(static_cast(last.get_node())!= @@ -571,6 +569,20 @@ public: } } + template + +#if !defined(BOOST_NO_SFINAE) + typename enable_if_c< + !is_const::value&& + is_same::value + >::type +#else + void +#endif + + merge(BOOST_RV_REF(Index) x){merge(static_cast(x));} + + /* observers */ key_from_value key_extractor()const{return key;} diff --git a/test/test_node_handling.cpp b/test/test_node_handling.cpp index a04040c..7ca0691 100644 --- a/test/test_node_handling.cpp +++ b/test/test_node_handling.cpp @@ -428,6 +428,14 @@ void test_merge() BOOST_TEST(c1.size()==10&&c2.size()==0); c2.merge(c1.get<2>()); BOOST_TEST(c1.size()==0&&c2.size()==10); + c2.merge(c2); + BOOST_TEST(c2.size()==10); + c2.merge(boost::move(c2)); + BOOST_TEST(c2.size()==10); + c2.merge(boost::move(c2.get<3>())); + BOOST_TEST(c2.size()==10); + c2.merge(container(c2)); + BOOST_TEST(c2.size()==20); } void test_node_handling()