Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/multi_index/sequenced_index.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
1 /* Copyright 2003-2013 Joaquin M Lopez Munoz. | 1 /* Copyright 2003-2014 Joaquin M Lopez Munoz. |
2 * Distributed under the Boost Software License, Version 1.0. | 2 * Distributed under the Boost Software License, Version 1.0. |
3 * (See accompanying file LICENSE_1_0.txt or copy at | 3 * (See accompanying file LICENSE_1_0.txt or copy at |
4 * http://www.boost.org/LICENSE_1_0.txt) | 4 * http://www.boost.org/LICENSE_1_0.txt) |
5 * | 5 * |
6 * See http://www.boost.org/libs/multi_index for library home page. | 6 * See http://www.boost.org/libs/multi_index for library home page. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP | 9 #ifndef BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP |
10 #define BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP | 10 #define BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP |
11 | 11 |
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200) | 12 #if defined(_MSC_VER) |
13 #pragma once | 13 #pragma once |
14 #endif | 14 #endif |
15 | 15 |
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ | 16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ |
17 #include <boost/call_traits.hpp> | 17 #include <boost/call_traits.hpp> |
27 #include <boost/mpl/push_front.hpp> | 27 #include <boost/mpl/push_front.hpp> |
28 #include <boost/multi_index/detail/access_specifier.hpp> | 28 #include <boost/multi_index/detail/access_specifier.hpp> |
29 #include <boost/multi_index/detail/bidir_node_iterator.hpp> | 29 #include <boost/multi_index/detail/bidir_node_iterator.hpp> |
30 #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> | 30 #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> |
31 #include <boost/multi_index/detail/index_node_base.hpp> | 31 #include <boost/multi_index/detail/index_node_base.hpp> |
32 #include <boost/multi_index/detail/safe_ctr_proxy.hpp> | |
33 #include <boost/multi_index/detail/safe_mode.hpp> | 32 #include <boost/multi_index/detail/safe_mode.hpp> |
34 #include <boost/multi_index/detail/scope_guard.hpp> | 33 #include <boost/multi_index/detail/scope_guard.hpp> |
35 #include <boost/multi_index/detail/seq_index_node.hpp> | 34 #include <boost/multi_index/detail/seq_index_node.hpp> |
36 #include <boost/multi_index/detail/seq_index_ops.hpp> | 35 #include <boost/multi_index/detail/seq_index_ops.hpp> |
37 #include <boost/multi_index/detail/vartempl_support.hpp> | 36 #include <boost/multi_index/detail/vartempl_support.hpp> |
73 template<typename SuperMeta,typename TagList> | 72 template<typename SuperMeta,typename TagList> |
74 class sequenced_index: | 73 class sequenced_index: |
75 BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type | 74 BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type |
76 | 75 |
77 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) | 76 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) |
78 #if BOOST_WORKAROUND(BOOST_MSVC,<1300) | |
79 ,public safe_ctr_proxy_impl< | |
80 bidir_node_iterator< | |
81 sequenced_index_node<typename SuperMeta::type::node_type> >, | |
82 sequenced_index<SuperMeta,TagList> > | |
83 #else | |
84 ,public safe_mode::safe_container< | 77 ,public safe_mode::safe_container< |
85 sequenced_index<SuperMeta,TagList> > | 78 sequenced_index<SuperMeta,TagList> > |
86 #endif | |
87 #endif | 79 #endif |
88 | 80 |
89 { | 81 { |
90 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ | 82 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ |
91 BOOST_WORKAROUND(__MWERKS__,<=0x3003) | 83 BOOST_WORKAROUND(__MWERKS__,<=0x3003) |
114 typedef typename super::final_allocator_type allocator_type; | 106 typedef typename super::final_allocator_type allocator_type; |
115 typedef typename allocator_type::reference reference; | 107 typedef typename allocator_type::reference reference; |
116 typedef typename allocator_type::const_reference const_reference; | 108 typedef typename allocator_type::const_reference const_reference; |
117 | 109 |
118 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) | 110 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) |
119 #if BOOST_WORKAROUND(BOOST_MSVC,<1300) | |
120 typedef safe_mode::safe_iterator< | |
121 bidir_node_iterator<node_type>, | |
122 safe_ctr_proxy< | |
123 bidir_node_iterator<node_type> > > iterator; | |
124 #else | |
125 typedef safe_mode::safe_iterator< | 111 typedef safe_mode::safe_iterator< |
126 bidir_node_iterator<node_type>, | 112 bidir_node_iterator<node_type>, |
127 sequenced_index> iterator; | 113 sequenced_index> iterator; |
128 #endif | |
129 #else | 114 #else |
130 typedef bidir_node_iterator<node_type> iterator; | 115 typedef bidir_node_iterator<node_type> iterator; |
131 #endif | 116 #endif |
132 | 117 |
133 typedef iterator const_iterator; | 118 typedef iterator const_iterator; |
163 typedef typename super::index_loader_type index_loader_type; | 148 typedef typename super::index_loader_type index_loader_type; |
164 #endif | 149 #endif |
165 | 150 |
166 private: | 151 private: |
167 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) | 152 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) |
168 #if BOOST_WORKAROUND(BOOST_MSVC,<1300) | |
169 typedef safe_ctr_proxy_impl< | |
170 bidir_node_iterator<node_type>, | |
171 sequenced_index> safe_super; | |
172 #else | |
173 typedef safe_mode::safe_container< | 153 typedef safe_mode::safe_container< |
174 sequenced_index> safe_super; | 154 sequenced_index> safe_super; |
175 #endif | |
176 #endif | 155 #endif |
177 | 156 |
178 typedef typename call_traits<value_type>::param_type value_param_type; | 157 typedef typename call_traits<value_type>::param_type value_param_type; |
179 | 158 |
180 /* Needed to avoid commas in BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL | 159 /* Needed to avoid commas in BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL |
224 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 203 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
225 clear(); | 204 clear(); |
226 for(size_type i=0;i<n;++i)push_back(value); | 205 for(size_type i=0;i<n;++i)push_back(value); |
227 } | 206 } |
228 | 207 |
229 allocator_type get_allocator()const | 208 allocator_type get_allocator()const BOOST_NOEXCEPT |
230 { | 209 { |
231 return this->final().get_allocator(); | 210 return this->final().get_allocator(); |
232 } | 211 } |
233 | 212 |
234 /* iterators */ | 213 /* iterators */ |
235 | 214 |
236 iterator begin() | 215 iterator begin()BOOST_NOEXCEPT |
237 {return make_iterator(node_type::from_impl(header()->next()));} | 216 {return make_iterator(node_type::from_impl(header()->next()));} |
238 const_iterator begin()const | 217 const_iterator begin()const BOOST_NOEXCEPT |
239 {return make_iterator(node_type::from_impl(header()->next()));} | 218 {return make_iterator(node_type::from_impl(header()->next()));} |
240 iterator end(){return make_iterator(header());} | 219 iterator |
241 const_iterator end()const{return make_iterator(header());} | 220 end()BOOST_NOEXCEPT{return make_iterator(header());} |
242 reverse_iterator rbegin(){return make_reverse_iterator(end());} | 221 const_iterator |
243 const_reverse_iterator rbegin()const{return make_reverse_iterator(end());} | 222 end()const BOOST_NOEXCEPT{return make_iterator(header());} |
244 reverse_iterator rend(){return make_reverse_iterator(begin());} | 223 reverse_iterator |
245 const_reverse_iterator rend()const{return make_reverse_iterator(begin());} | 224 rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} |
246 const_iterator cbegin()const{return begin();} | 225 const_reverse_iterator |
247 const_iterator cend()const{return end();} | 226 rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} |
248 const_reverse_iterator crbegin()const{return rbegin();} | 227 reverse_iterator |
249 const_reverse_iterator crend()const{return rend();} | 228 rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} |
229 const_reverse_iterator | |
230 rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} | |
231 const_iterator | |
232 cbegin()const BOOST_NOEXCEPT{return begin();} | |
233 const_iterator | |
234 cend()const BOOST_NOEXCEPT{return end();} | |
235 const_reverse_iterator | |
236 crbegin()const BOOST_NOEXCEPT{return rbegin();} | |
237 const_reverse_iterator | |
238 crend()const BOOST_NOEXCEPT{return rend();} | |
250 | 239 |
251 iterator iterator_to(const value_type& x) | 240 iterator iterator_to(const value_type& x) |
252 { | 241 { |
253 return make_iterator(node_from_value<node_type>(&x)); | 242 return make_iterator(node_from_value<node_type>(&x)); |
254 } | 243 } |
258 return make_iterator(node_from_value<node_type>(&x)); | 247 return make_iterator(node_from_value<node_type>(&x)); |
259 } | 248 } |
260 | 249 |
261 /* capacity */ | 250 /* capacity */ |
262 | 251 |
263 bool empty()const{return this->final_empty_();} | 252 bool empty()const BOOST_NOEXCEPT{return this->final_empty_();} |
264 size_type size()const{return this->final_size_();} | 253 size_type size()const BOOST_NOEXCEPT{return this->final_size_();} |
265 size_type max_size()const{return this->final_max_size_();} | 254 size_type max_size()const BOOST_NOEXCEPT{return this->final_max_size_();} |
266 | 255 |
267 void resize(size_type n) | 256 void resize(size_type n) |
268 { | 257 { |
269 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 258 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
270 if(n>size()){ | 259 if(n>size()){ |
420 return this->final_modify_( | 409 return this->final_modify_( |
421 mod,static_cast<final_node_type*>(position.get_node())); | 410 mod,static_cast<final_node_type*>(position.get_node())); |
422 } | 411 } |
423 | 412 |
424 template<typename Modifier,typename Rollback> | 413 template<typename Modifier,typename Rollback> |
425 bool modify(iterator position,Modifier mod,Rollback back) | 414 bool modify(iterator position,Modifier mod,Rollback back_) |
426 { | 415 { |
427 BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); | 416 BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); |
428 BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); | 417 BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); |
429 BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); | 418 BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); |
430 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 419 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
437 | 426 |
438 position.detach(); | 427 position.detach(); |
439 #endif | 428 #endif |
440 | 429 |
441 return this->final_modify_( | 430 return this->final_modify_( |
442 mod,back,static_cast<final_node_type*>(position.get_node())); | 431 mod,back_,static_cast<final_node_type*>(position.get_node())); |
443 } | 432 } |
444 | 433 |
445 void swap(sequenced_index<SuperMeta,TagList>& x) | 434 void swap(sequenced_index<SuperMeta,TagList>& x) |
446 { | 435 { |
447 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 436 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
448 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x); | 437 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x); |
449 this->final_swap_(x.final()); | 438 this->final_swap_(x.final()); |
450 } | 439 } |
451 | 440 |
452 void clear() | 441 void clear()BOOST_NOEXCEPT |
453 { | 442 { |
454 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 443 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
455 this->final_clear_(); | 444 this->final_clear_(); |
456 } | 445 } |
457 | 446 |
569 { | 558 { |
570 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 559 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
571 sequenced_index_sort(header(),comp); | 560 sequenced_index_sort(header(),comp); |
572 } | 561 } |
573 | 562 |
574 void reverse() | 563 void reverse()BOOST_NOEXCEPT |
575 { | 564 { |
576 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; | 565 BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; |
577 node_impl_type::reverse(header()->impl()); | 566 node_impl_type::reverse(header()->impl()); |
578 } | 567 } |
579 | 568 |
677 | 666 |
678 super::copy_(x,map); | 667 super::copy_(x,map); |
679 } | 668 } |
680 | 669 |
681 template<typename Variant> | 670 template<typename Variant> |
682 node_type* insert_(value_param_type v,node_type* x,Variant variant) | 671 final_node_type* insert_( |
683 { | 672 value_param_type v,final_node_type*& x,Variant variant) |
684 node_type* res=static_cast<node_type*>(super::insert_(v,x,variant)); | 673 { |
685 if(res==x)link(x); | 674 final_node_type* res=super::insert_(v,x,variant); |
675 if(res==x)link(static_cast<node_type*>(x)); | |
686 return res; | 676 return res; |
687 } | 677 } |
688 | 678 |
689 template<typename Variant> | 679 template<typename Variant> |
690 node_type* insert_( | 680 final_node_type* insert_( |
691 value_param_type v,node_type* position,node_type* x,Variant variant) | 681 value_param_type v,node_type* position,final_node_type*& x,Variant variant) |
692 { | 682 { |
693 node_type* res= | 683 final_node_type* res=super::insert_(v,position,x,variant); |
694 static_cast<node_type*>(super::insert_(v,position,x,variant)); | 684 if(res==x)link(static_cast<node_type*>(x)); |
695 if(res==x)link(x); | |
696 return res; | 685 return res; |
697 } | 686 } |
698 | 687 |
699 void erase_(node_type* x) | 688 void erase_(node_type* x) |
700 { | 689 { |
794 template<typename Archive> | 783 template<typename Archive> |
795 void load_( | 784 void load_( |
796 Archive& ar,const unsigned int version,const index_loader_type& lm) | 785 Archive& ar,const unsigned int version,const index_loader_type& lm) |
797 { | 786 { |
798 lm.load( | 787 lm.load( |
799 ::boost::bind(&sequenced_index::rearranger,this,_1,_2), | 788 ::boost::bind( |
789 &sequenced_index::rearranger,this,::boost::arg<1>(),::boost::arg<2>()), | |
800 ar,version); | 790 ar,version); |
801 super::load_(ar,version,lm); | 791 super::load_(ar,version,lm); |
802 } | 792 } |
803 #endif | 793 #endif |
804 | 794 |