Boost logo

Boost :

Subject: Re: [boost] [containers] flat_set/flat_map could add insert_sorted(begin, end)
From: igaztanaga_at_[hidden]
Date: 2010-04-20 18:10:14


On 20/04/2010 17:46, Thorsten Ottosen wrote:
> Hi Ion,
>
> I think the above member could be useful (taking an already sorted
> sequence), especially if
> the container needs to reallocate, in which case we may merge the
> two sequences
>
> [begin,end)
> [lower_bound(*begin),upper_bound(*(end-1))]
>
> and copy the unaltered prefix and suffix.

But we don't know the final size of the the container without comparing
each value to be inesrted, what's your suggestion? And should the input
sequence contain unique values for set/map?

> Furthermore, even when we don't have to reallocate, we can
> bulk copy the suffix and simulate merging for the infix range.

The question is how we know we don't need to reallocate.

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk