diff options
Diffstat (limited to 'boost/multi_index/ordered_index.hpp')
-rw-r--r-- | boost/multi_index/ordered_index.hpp | 306 |
1 files changed, 212 insertions, 94 deletions
diff --git a/boost/multi_index/ordered_index.hpp b/boost/multi_index/ordered_index.hpp index 20475e0852..3f0ae5d84a 100644 --- a/boost/multi_index/ordered_index.hpp +++ b/boost/multi_index/ordered_index.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2011 Joaquin M Lopez Munoz. +/* Copyright 2003-2014 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) @@ -36,7 +36,7 @@ #ifndef BOOST_MULTI_INDEX_ORDERED_INDEX_HPP #define BOOST_MULTI_INDEX_ORDERED_INDEX_HPP -#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#if defined(_MSC_VER) #pragma once #endif @@ -47,26 +47,32 @@ #include <boost/detail/workaround.hpp> #include <boost/foreach_fwd.hpp> #include <boost/iterator/reverse_iterator.hpp> +#include <boost/move/core.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/push_front.hpp> #include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/bidir_node_iterator.hpp> +#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/index_node_base.hpp> #include <boost/multi_index/detail/modify_key_adaptor.hpp> #include <boost/multi_index/detail/ord_index_node.hpp> #include <boost/multi_index/detail/ord_index_ops.hpp> -#include <boost/multi_index/detail/safe_ctr_proxy.hpp> #include <boost/multi_index/detail/safe_mode.hpp> #include <boost/multi_index/detail/scope_guard.hpp> #include <boost/multi_index/detail/unbounded.hpp> #include <boost/multi_index/detail/value_compare.hpp> +#include <boost/multi_index/detail/vartempl_support.hpp> #include <boost/multi_index/ordered_index_fwd.hpp> #include <boost/ref.hpp> #include <boost/tuple/tuple.hpp> #include <boost/type_traits/is_same.hpp> #include <utility> +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include <initializer_list> +#endif + #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include <boost/archive/archive_exception.hpp> #include <boost/bind.hpp> @@ -75,11 +81,14 @@ #endif #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) -#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT \ +#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x) \ detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ - detail::make_obj_guard(*this,&ordered_index::check_invariant_); \ + detail::make_obj_guard(x,&ordered_index::check_invariant_); \ BOOST_JOIN(check_invariant_,__LINE__).touch(); +#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT \ + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(*this) #else +#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x) #define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT #endif @@ -107,16 +116,9 @@ class ordered_index: BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) - ,public safe_ctr_proxy_impl< - bidir_node_iterator< - ordered_index_node<typename SuperMeta::type::node_type> >, - ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category> > -#else ,public safe_mode::safe_container< ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category> > #endif -#endif { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ @@ -154,16 +156,9 @@ public: typedef typename allocator_type::const_reference const_reference; #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) - typedef safe_mode::safe_iterator< - bidir_node_iterator<node_type>, - safe_ctr_proxy< - bidir_node_iterator<node_type> > > iterator; -#else typedef safe_mode::safe_iterator< bidir_node_iterator<node_type>, ordered_index> iterator; -#endif #else typedef bidir_node_iterator<node_type> iterator; #endif @@ -203,20 +198,20 @@ protected: private: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) - typedef safe_ctr_proxy_impl< - bidir_node_iterator<node_type>, - ordered_index> safe_super; -#else typedef safe_mode::safe_container<ordered_index> safe_super; #endif -#endif typedef typename call_traits< value_type>::param_type value_param_type; typedef typename call_traits< key_type>::param_type key_param_type; + /* Needed to avoid commas in BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL + * expansion. + */ + + typedef std::pair<iterator,bool> emplace_return_type; + public: /* construct/copy/destroy @@ -231,25 +226,46 @@ public: return *this; } - allocator_type get_allocator()const +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& operator=( + std::initializer_list<value_type> list) + { + this->final()=list; + return *this; + } +#endif + + allocator_type get_allocator()const BOOST_NOEXCEPT { return this->final().get_allocator(); } /* iterators */ - iterator begin(){return make_iterator(leftmost());} - const_iterator begin()const{return make_iterator(leftmost());} - iterator end(){return make_iterator(header());} - const_iterator end()const{return make_iterator(header());} - reverse_iterator rbegin(){return make_reverse_iterator(end());} - const_reverse_iterator rbegin()const{return make_reverse_iterator(end());} - reverse_iterator rend(){return make_reverse_iterator(begin());} - const_reverse_iterator rend()const{return make_reverse_iterator(begin());} - const_iterator cbegin()const{return begin();} - const_iterator cend()const{return end();} - const_reverse_iterator crbegin()const{return rbegin();} - const_reverse_iterator crend()const{return rend();} + iterator + begin()BOOST_NOEXCEPT{return make_iterator(leftmost());} + const_iterator + begin()const BOOST_NOEXCEPT{return make_iterator(leftmost());} + iterator + end()BOOST_NOEXCEPT{return make_iterator(header());} + const_iterator + end()const BOOST_NOEXCEPT{return make_iterator(header());} + reverse_iterator + rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} + const_reverse_iterator + rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} + reverse_iterator + rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} + const_reverse_iterator + rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} + const_iterator + cbegin()const BOOST_NOEXCEPT{return begin();} + const_iterator + cend()const BOOST_NOEXCEPT{return end();} + const_reverse_iterator + crbegin()const BOOST_NOEXCEPT{return rbegin();} + const_reverse_iterator + crend()const BOOST_NOEXCEPT{return rend();} iterator iterator_to(const value_type& x) { @@ -263,20 +279,33 @@ public: /* capacity */ - bool empty()const{return this->final_empty_();} - size_type size()const{return this->final_size_();} - size_type max_size()const{return this->final_max_size_();} + bool empty()const BOOST_NOEXCEPT{return this->final_empty_();} + size_type size()const BOOST_NOEXCEPT{return this->final_size_();} + size_type max_size()const BOOST_NOEXCEPT{return this->final_max_size_();} /* modifiers */ - std::pair<iterator,bool> insert(value_param_type x) + BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( + emplace_return_type,emplace,emplace_impl) + + BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( + iterator,emplace_hint,emplace_hint_impl,iterator,position) + + std::pair<iterator,bool> insert(const value_type& x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool> p=this->final_insert_(x); return std::pair<iterator,bool>(make_iterator(p.first),p.second); } - iterator insert(iterator position,value_param_type x) + std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_rv_(x); + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + iterator insert(iterator position,const value_type& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -286,14 +315,35 @@ public: return make_iterator(p.first); } + iterator insert(iterator position,BOOST_RV_REF(value_type) x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_rv_( + x,static_cast<final_node_type*>(position.get_node())); + return make_iterator(p.first); + } + template<typename InputIterator> void insert(InputIterator first,InputIterator last) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; - iterator hint=end(); - for(;first!=last;++first)hint=insert(hint,*first); + node_type* hint=header(); /* end() */ + for(;first!=last;++first){ + hint=this->final_insert_ref_( + *first,static_cast<final_node_type*>(hint)).first; + node_type::increment(hint); + } } +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type> list) + { + insert(list.begin(),list.end()); + } +#endif + iterator erase(iterator position) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); @@ -330,7 +380,7 @@ public: return first; } - bool replace(iterator position,value_param_type x) + bool replace(iterator position,const value_type& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -340,6 +390,16 @@ public: x,static_cast<final_node_type*>(position.get_node())); } + bool replace(iterator position,BOOST_RV_REF(value_type) x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + return this->final_replace_rv_( + x,static_cast<final_node_type*>(position.get_node())); + } + template<typename Modifier> bool modify(iterator position,Modifier mod) { @@ -362,7 +422,7 @@ public: } template<typename Modifier,typename Rollback> - bool modify(iterator position,Modifier mod,Rollback back) + bool modify(iterator position,Modifier mod,Rollback back_) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -379,7 +439,7 @@ public: #endif return this->final_modify_( - mod,back,static_cast<final_node_type*>(position.get_node())); + mod,back_,static_cast<final_node_type*>(position.get_node())); } template<typename Modifier> @@ -394,7 +454,7 @@ public: } template<typename Modifier,typename Rollback> - bool modify_key(iterator position,Modifier mod,Rollback back) + bool modify_key(iterator position,Modifier mod,Rollback back_) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -403,16 +463,17 @@ public: return modify( position, modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key), - modify_key_adaptor<Rollback,value_type,KeyFromValue>(back,key)); + modify_key_adaptor<Rollback,value_type,KeyFromValue>(back_,key)); } void swap(ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x); this->final_swap_(x.final()); } - void clear() + void clear()BOOST_NOEXCEPT { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; this->final_clear_(); @@ -421,8 +482,8 @@ public: /* observers */ key_from_value key_extractor()const{return key;} - key_compare key_comp()const{return comp;} - value_compare value_comp()const{return value_compare(key,comp);} + key_compare key_comp()const{return comp_;} + value_compare value_comp()const{return value_compare(key,comp_);} /* set operations */ @@ -433,7 +494,7 @@ public: template<typename CompatibleKey> iterator find(const CompatibleKey& x)const { - return make_iterator(ordered_index_find(root(),header(),key,x,comp)); + return make_iterator(ordered_index_find(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> @@ -446,7 +507,7 @@ public: template<typename CompatibleKey> size_type count(const CompatibleKey& x)const { - return count(x,comp); + return count(x,comp_); } template<typename CompatibleKey,typename CompatibleCompare> @@ -461,7 +522,7 @@ public: iterator lower_bound(const CompatibleKey& x)const { return make_iterator( - ordered_index_lower_bound(root(),header(),key,x,comp)); + ordered_index_lower_bound(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> @@ -476,7 +537,7 @@ public: iterator upper_bound(const CompatibleKey& x)const { return make_iterator( - ordered_index_upper_bound(root(),header(),key,x,comp)); + ordered_index_upper_bound(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> @@ -492,7 +553,7 @@ public: const CompatibleKey& x)const { std::pair<node_type*,node_type*> p= - ordered_index_equal_range(root(),header(),key,x,comp); + ordered_index_equal_range(root(),header(),key,x,comp_); return std::pair<iterator,iterator>( make_iterator(p.first),make_iterator(p.second)); } @@ -534,7 +595,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: ordered_index(const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al), key(tuples::get<0>(args_list.get_head())), - comp(tuples::get<1>(args_list.get_head())) + comp_(tuples::get<1>(args_list.get_head())) { empty_initialize(); } @@ -548,13 +609,28 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: #endif key(x.key), - comp(x.comp) + comp_(x.comp_) { /* Copy ctor just takes the key and compare objects from x. The rest is - * done in subsequent call to copy_(). + * done in a subsequent call to copy_(). */ } + ordered_index( + const ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x, + do_not_copy_elements_tag): + super(x,do_not_copy_elements_tag()), + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super(), +#endif + + key(x.key), + comp_(x.comp_) + { + empty_initialize(); + } + ~ordered_index() { /* the container is guaranteed to be empty by now */ @@ -623,30 +699,36 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: super::copy_(x,map); } - node_type* insert_(value_param_type v,node_type* x) + template<typename Variant> + final_node_type* insert_( + value_param_type v,final_node_type*& x,Variant variant) { link_info inf; if(!link_point(key(v),inf,Category())){ - return node_type::from_impl(inf.pos); + return static_cast<final_node_type*>(node_type::from_impl(inf.pos)); } - node_type* res=static_cast<node_type*>(super::insert_(v,x)); + final_node_type* res=super::insert_(v,x,variant); if(res==x){ - node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + node_impl_type::link( + static_cast<node_type*>(x)->impl(),inf.side,inf.pos,header()->impl()); } return res; } - node_type* insert_(value_param_type v,node_type* position,node_type* x) + template<typename Variant> + final_node_type* insert_( + value_param_type v,node_type* position,final_node_type*& x,Variant variant) { link_info inf; if(!hinted_link_point(key(v),position,inf,Category())){ - return node_type::from_impl(inf.pos); + return static_cast<final_node_type*>(node_type::from_impl(inf.pos)); } - node_type* res=static_cast<node_type*>(super::insert_(v,position,x)); + final_node_type* res=super::insert_(v,position,x,variant); if(res==x){ - node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + node_impl_type::link( + static_cast<node_type*>(x)->impl(),inf.side,inf.pos,header()->impl()); } return res; } @@ -680,7 +762,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: void swap_(ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) { std::swap(key,x.key); - std::swap(comp,x.comp); + std::swap(comp_,x.comp_); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super::swap(x); @@ -689,10 +771,21 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: super::swap_(x); } - bool replace_(value_param_type v,node_type* x) + void swap_elements_( + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) + { +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::swap(x); +#endif + + super::swap_elements_(x); + } + + template<typename Variant> + bool replace_(value_param_type v,node_type* x,Variant variant) { if(in_place(v,x,Category())){ - return super::replace_(v,x); + return super::replace_(v,x,variant); } node_type* next=x; @@ -703,7 +796,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: BOOST_TRY{ link_info inf; - if(link_point(key(v),inf,Category())&&super::replace_(v,x)){ + if(link_point(key(v),inf,Category())&&super::replace_(v,x,variant)){ node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); return true; } @@ -851,8 +944,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: if((left_x&&left_x->color()==red)|| (right_x&&right_x->color()==red))return false; } - if(left_x&&comp(key(x->value()),key(left_x->value())))return false; - if(right_x&&comp(key(right_x->value()),key(x->value())))return false; + if(left_x&&comp_(key(x->value()),key(left_x->value())))return false; + if(right_x&&comp_(key(right_x->value()),key(x->value())))return false; if(!left_x&&!right_x&& node_impl_type::black_count(x->impl(),root()->impl())!=len) return false; @@ -907,7 +1000,7 @@ private: bool c=true; while(x){ y=x; - c=comp(k,key(x->value())); + c=comp_(k,key(x->value())); x=node_type::from_impl(c?x->left():x->right()); } node_type* yy=y; @@ -920,7 +1013,7 @@ private: else node_type::decrement(yy); } - if(comp(key(yy->value()),k)){ + if(comp_(key(yy->value()),k)){ inf.side=c?to_left:to_right; inf.pos=y->impl(); return true; @@ -938,7 +1031,7 @@ private: bool c=true; while (x){ y=x; - c=comp(k,key(x->value())); + c=comp_(k,key(x->value())); x=node_type::from_impl(c?x->left():x->right()); } inf.side=c?to_left:to_right; @@ -953,7 +1046,7 @@ private: bool c=false; while (x){ y=x; - c=comp(key(x->value()),k); + c=comp_(key(x->value()),k); x=node_type::from_impl(c?x->right():x->left()); } inf.side=c?to_right:to_left; @@ -965,7 +1058,7 @@ private: key_param_type k,node_type* position,link_info& inf,ordered_unique_tag) { if(position->impl()==header()->left()){ - if(size()>0&&comp(k,key(position->value()))){ + if(size()>0&&comp_(k,key(position->value()))){ inf.side=to_left; inf.pos=position->impl(); return true; @@ -973,7 +1066,7 @@ private: else return link_point(k,inf,ordered_unique_tag()); } else if(position==header()){ - if(comp(key(rightmost()->value()),k)){ + if(comp_(key(rightmost()->value()),k)){ inf.side=to_right; inf.pos=rightmost()->impl(); return true; @@ -983,7 +1076,7 @@ private: else{ node_type* before=position; node_type::decrement(before); - if(comp(key(before->value()),k)&&comp(k,key(position->value()))){ + if(comp_(key(before->value()),k)&&comp_(k,key(position->value()))){ if(before->right()==node_impl_pointer(0)){ inf.side=to_right; inf.pos=before->impl(); @@ -1003,7 +1096,7 @@ private: key_param_type k,node_type* position,link_info& inf,ordered_non_unique_tag) { if(position->impl()==header()->left()){ - if(size()>0&&!comp(key(position->value()),k)){ + if(size()>0&&!comp_(key(position->value()),k)){ inf.side=to_left; inf.pos=position->impl(); return true; @@ -1011,7 +1104,7 @@ private: else return lower_link_point(k,inf,ordered_non_unique_tag()); } else if(position==header()){ - if(!comp(k,key(rightmost()->value()))){ + if(!comp_(k,key(rightmost()->value()))){ inf.side=to_right; inf.pos=rightmost()->impl(); return true; @@ -1021,8 +1114,8 @@ private: else{ node_type* before=position; node_type::decrement(before); - if(!comp(k,key(before->value()))){ - if(!comp(key(position->value()),k)){ + if(!comp_(k,key(before->value()))){ + if(!comp_(key(position->value()),k)){ if(before->right()==node_impl_pointer(0)){ inf.side=to_right; inf.pos=before->impl(); @@ -1055,12 +1148,12 @@ private: if(x!=leftmost()){ y=x; node_type::decrement(y); - if(!comp(key(y->value()),key(v)))return false; + if(!comp_(key(y->value()),key(v)))return false; } y=x; node_type::increment(y); - return y==header()||comp(key(v),key(y->value())); + return y==header()||comp_(key(v),key(y->value())); } bool in_place(value_param_type v,node_type* x,ordered_non_unique_tag) @@ -1069,12 +1162,12 @@ private: if(x!=leftmost()){ y=x; node_type::decrement(y); - if(comp(key(v),key(y->value())))return false; + if(comp_(key(v),key(y->value())))return false; } y=x; node_type::increment(y); - return y==header()||!comp(key(y->value()),key(v)); + return y==header()||!comp_(key(y->value()),key(v)); } #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) @@ -1085,6 +1178,29 @@ private: } #endif + template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK> + std::pair<iterator,bool> emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool>p= + this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK> + iterator emplace_hint_impl( + iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool>p= + this->final_emplace_hint_( + static_cast<final_node_type*>(position.get_node()), + BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + return make_iterator(p.first); + } + template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder lower,UpperBounder upper,none_unbounded_tag)const @@ -1202,17 +1318,18 @@ private: ordered_non_unique_tag) { lm.load( - ::boost::bind(&ordered_index::rearranger,this,_1,_2), + ::boost::bind( + &ordered_index::rearranger,this,::boost::arg<1>(),::boost::arg<2>()), ar,version); super::load_(ar,version,lm); } void rearranger(node_type* position,node_type *x) { - if(!position||comp(key(position->value()),key(x->value()))){ + if(!position||comp_(key(position->value()),key(x->value()))){ position=lower_bound(key(x->value())).get_node(); } - else if(comp(key(x->value()),key(position->value()))){ + else if(comp_(key(x->value()),key(position->value()))){ /* inconsistent rearrangement */ throw_exception( archive::archive_exception( @@ -1230,7 +1347,7 @@ private: #endif /* serialization */ key_from_value key; - key_compare comp; + key_compare comp_; #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) @@ -1402,5 +1519,6 @@ inline boost::mpl::true_* boost_foreach_is_noncopyable( } #undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT +#undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF #endif |