mirror of
https://github.com/boostorg/multi_index.git
synced 2025-05-11 05:14:05 +00:00
added rvalue ref merge
(test expected to fail in C++03)
This commit is contained in:
parent
6dd60d07ac
commit
7d2b9dd808
@ -77,7 +77,6 @@
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_SFINAE)
|
#if !defined(BOOST_NO_SFINAE)
|
||||||
#include <boost/type_traits/is_const.hpp>
|
#include <boost/type_traits/is_const.hpp>
|
||||||
#include <boost/type_traits/remove_reference.hpp>
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -546,9 +545,8 @@ public:
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_SFINAE)
|
#if !defined(BOOST_NO_SFINAE)
|
||||||
typename enable_if_c<
|
typename enable_if_c<
|
||||||
is_same<
|
!is_const<Index>::value&&
|
||||||
typename remove_reference<Index>::type::node_type,node_type>::value&&
|
is_same<typename Index::node_type,node_type>::value
|
||||||
!is_const<typename remove_reference<Index>::type>::value
|
|
||||||
>::type
|
>::type
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
@ -559,7 +557,7 @@ public:
|
|||||||
BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x);
|
BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x);
|
||||||
BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT;
|
BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT;
|
||||||
|
|
||||||
typedef typename remove_reference<Index>::type::iterator source_iterator;
|
typedef typename Index::iterator source_iterator;
|
||||||
|
|
||||||
source_iterator first=x.begin(),last=x.end();
|
source_iterator first=x.begin(),last=x.end();
|
||||||
if(static_cast<final_node_type*>(last.get_node())!=
|
if(static_cast<final_node_type*>(last.get_node())!=
|
||||||
@ -571,6 +569,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Index>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_SFINAE)
|
||||||
|
typename enable_if_c<
|
||||||
|
!is_const<Index>::value&&
|
||||||
|
is_same<typename Index::node_type,node_type>::value
|
||||||
|
>::type
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
#endif
|
||||||
|
|
||||||
|
merge(BOOST_RV_REF(Index) x){merge(static_cast<Index&>(x));}
|
||||||
|
|
||||||
|
|
||||||
/* observers */
|
/* observers */
|
||||||
|
|
||||||
key_from_value key_extractor()const{return key;}
|
key_from_value key_extractor()const{return key;}
|
||||||
|
@ -428,6 +428,14 @@ void test_merge()
|
|||||||
BOOST_TEST(c1.size()==10&&c2.size()==0);
|
BOOST_TEST(c1.size()==10&&c2.size()==0);
|
||||||
c2.merge(c1.get<2>());
|
c2.merge(c1.get<2>());
|
||||||
BOOST_TEST(c1.size()==0&&c2.size()==10);
|
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()
|
void test_node_handling()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user