Ejemplo n.º 1
0
	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;
	}
Ejemplo n.º 2
0
	iterator insert(iterator pos, Iter first, Iter last) {
		//TODO: when GCC has fixed insert just directly return it's value
		auto dist=std::distance(begin(), pos);
		values.insert(pos, first, last);
		return values.begin() + dist;
	}
Ejemplo n.º 3
0
//Mutuate
	iterator insert(iterator it, value_type value) {
		return values.insert(it, std::move(value));
	}
Ejemplo n.º 4
0
	range_size_type simple_merge(container_type& set, iterator where, const range_type& new_range)
	{
		set.insert( where, new_range );
		m_length_sum += new_range.size();
		return new_range.size();
	}