On Wed, Nov 23, 2011 at 6:50 PM, Nathan Ridge <zeratul976@hotmail.com> wrote:

> The title says it all really. The failure occurs because the insert
> algorithm expects the container
> to provide a 3-arg insert of the form
>
> container.insert( position, begin, end );
>
> whereas map's, multimap's and set's insert method only takes two arguments...
>
> map.insert( begin, end );
>
> Is this limitation by design? It would be easy to provide
> specialisations for maps, mmaps and sets, but
> that would not be a completely general solution.

I think what we really need is a second insert algorithm.

The one we have right now:

Container& insert(Container& target,
                              typename Container::iterator before,
                              const SinglePassRange& from);

should call target.insert(before, begin, end), and only work for sequence containers,

while a new one:

Container& insert(Container& target,
                              const SinglePassRange& from);


should call target.insert(begin, end), and only work for associative containers
(or any other container where you have no control over the position it's inserted
at, e.g. a hypothetical sorted vector).

I don't think it makes sense to try and get the first one to work for associative
containers, because the "before" parameter is meaningless for those.


Darn.. bumped into this one again! Neil, is there any likelihood of any action on this one? I think
Nate's suggestion would be ok, although it would introduce an overload without some SFINAE protection. 

Thx, Rob.