comparison DEPENDENCIES/generic/include/boost/icl/interval_base_map.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
213 BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); 213 BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
214 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<CodomainT>)); 214 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<CodomainT>));
215 BOOST_CONCEPT_ASSERT((EqualComparableConcept<CodomainT>)); 215 BOOST_CONCEPT_ASSERT((EqualComparableConcept<CodomainT>));
216 } 216 }
217 217
218 # ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
219 //==========================================================================
220 //= Move semantics
221 //==========================================================================
222
223 /** Move constructor */
224 interval_base_map(interval_base_map&& src): _map(boost::move(src._map))
225 {
226 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
227 BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
228 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<CodomainT>));
229 BOOST_CONCEPT_ASSERT((EqualComparableConcept<CodomainT>));
230 }
231
232 /** Move assignment operator */
233 interval_base_map& operator = (interval_base_map src)
234 { //call by value sice 'src' is a "sink value"
235 this->_map = boost::move(src._map);
236 return *this;
237 }
238
239 //==========================================================================
240 # else
241
218 /** Copy assignment operator */ 242 /** Copy assignment operator */
219 interval_base_map& operator = (const interval_base_map& src) 243 interval_base_map& operator = (const interval_base_map& src)
220 { 244 {
221 this->_map = src._map; 245 this->_map = src._map;
222 return *this; 246 return *this;
223 } 247 }
224 248
225 # ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
226 //==========================================================================
227 //= Move semantics
228 //==========================================================================
229
230 /** Move constructor */
231 interval_base_map(interval_base_map&& src): _map(boost::move(src._map))
232 {
233 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
234 BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
235 BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<CodomainT>));
236 BOOST_CONCEPT_ASSERT((EqualComparableConcept<CodomainT>));
237 }
238
239 /** Move assignment operator */
240 interval_base_map& operator = (interval_base_map&& src)
241 {
242 this->_map = boost::move(src._map);
243 return *this;
244 }
245
246 //==========================================================================
247 # endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES 249 # endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
248 250
249 /** swap the content of containers */ 251 /** swap the content of containers */
250 void swap(interval_base_map& object) { _map.swap(object._map); } 252 void swap(interval_base_map& object) { _map.swap(object._map); }
251 253
843 interval_type lead_gap = right_subtract(inter_val, (*it_).first); 845 interval_type lead_gap = right_subtract(inter_val, (*it_).first);
844 if(!icl::is_empty(lead_gap)) 846 if(!icl::is_empty(lead_gap))
845 { 847 {
846 // [lead_gap--- . . . 848 // [lead_gap--- . . .
847 // [-- it_ ... 849 // [-- it_ ...
848 iterator prior_ = prior(it_); 850 iterator prior_ = it_==this->_map.begin()? it_ : prior(it_);
849 iterator inserted_ = this->template gap_insert<Combiner>(prior_, lead_gap, co_val); 851 iterator inserted_ = this->template gap_insert<Combiner>(prior_, lead_gap, co_val);
850 that()->handle_inserted(prior_, inserted_); 852 that()->handle_inserted(prior_, inserted_);
851 } 853 }
852 854
853 // . . . --------- . . . addend interval 855 // . . . --------- . . . addend interval
955 return that()->handle_inserted(insertion.first); 957 return that()->handle_inserted(insertion.first);
956 else 958 else
957 { 959 {
958 // Detect the first and the end iterator of the collision sequence 960 // Detect the first and the end iterator of the collision sequence
959 iterator first_ = this->_map.lower_bound(inter_val), 961 iterator first_ = this->_map.lower_bound(inter_val),
960 last_ = insertion.first; 962 last_ = prior(this->_map.upper_bound(inter_val));
961 //assert(end_ == this->_map.upper_bound(inter_val)); 963 //assert(end_ == this->_map.upper_bound(inter_val));
962 iterator it_ = first_; 964 iterator it_ = first_;
963 interval_type rest_interval = inter_val; 965 interval_type rest_interval = inter_val;
964 966
965 add_front (rest_interval, it_ ); 967 add_front (rest_interval, it_ );
1094 inline void interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> 1096 inline void interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
1095 ::insert_main(const interval_type& inter_val, const CodomainT& co_val, 1097 ::insert_main(const interval_type& inter_val, const CodomainT& co_val,
1096 iterator& it_, const iterator& last_) 1098 iterator& it_, const iterator& last_)
1097 { 1099 {
1098 iterator end_ = boost::next(last_); 1100 iterator end_ = boost::next(last_);
1099 iterator prior_ = it_, inserted_; 1101 iterator prior_ = cyclic_prior(*this,it_), inserted_;
1100 if(prior_ != this->_map.end())
1101 --prior_;
1102 interval_type rest_interval = inter_val, left_gap, cur_itv; 1102 interval_type rest_interval = inter_val, left_gap, cur_itv;
1103 interval_type last_interval = last_ ->first; 1103 interval_type last_interval = last_ ->first;
1104 1104
1105 while(it_ != end_ ) 1105 while(it_ != end_ )
1106 { 1106 {
1150 return that()->handle_inserted(insertion.first); 1150 return that()->handle_inserted(insertion.first);
1151 else 1151 else
1152 { 1152 {
1153 // Detect the first and the end iterator of the collision sequence 1153 // Detect the first and the end iterator of the collision sequence
1154 iterator first_ = this->_map.lower_bound(inter_val), 1154 iterator first_ = this->_map.lower_bound(inter_val),
1155 last_ = insertion.first; 1155 last_ = prior(this->_map.upper_bound(inter_val));
1156 //assert((++last_) == this->_map.upper_bound(inter_val)); 1156 //assert((++last_) == this->_map.upper_bound(inter_val));
1157 iterator it_ = first_; 1157 iterator it_ = first_;
1158 insert_main(inter_val, co_val, it_, last_); 1158 insert_main(inter_val, co_val, it_, last_);
1159 return it_; 1159 return it_;
1160 } 1160 }