void setnext(size_t n){ size_t nelem = v.size(); if( n != nelem ){ v = b(c); } next = v.begin() + n; }
const_iterator_pair merge_range(const range_type& key) const { const_iterator_pair sequence( equal_range( key ) ); if ( sequence.first != m_set.begin() && ( --sequence.first )->end() < key.begin() ) ++sequence.first; if ( sequence.second != m_set.end() && sequence.second->begin() == key.end() ) ++sequence.second; return sequence; }
range_size_type merge_and_replace(container_type& set, iterator_pair sequence, const range_type& new_range) { ASSERT( sequence.first != sequence.second ); if ( sequence.first->begin() <= new_range.begin() && sequence.first->end() >= new_range.end() ) return 0; range_size_type old_sum = m_length_sum; range_size_type low = min( sequence.first->begin(), new_range.begin() ); range_size_type high = max( ( --sequence.second )->end(), new_range.end() ); for ( ++sequence.second; sequence.first != sequence.second; ) { range_size_type length = sequence.first->size(); set.erase( sequence.first++ ); m_length_sum -= length; } set.insert( sequence.second, range_type( low, high ) ); m_length_sum += high - low; return m_length_sum - old_sum; }
range_size_type overlapping_sum(const range_type& key) const { const_iterator_pair sequence( equal_range( key ) ); range_size_type sum = 0; for ( ; sequence.first != sequence.second; ++sequence.first ) { sum += min( sequence.first->end(), key.end() ) - max( sequence.first->begin(), key.begin() ); } return sum; }
size_t nth() const { return next - v.begin(); }