Boost logo

Boost Users :

From: ivan_dobrianov (ivan_dobrianov_at_[hidden])
Date: 2002-02-27 16:30:08


Does anyone know of any existing standard tool [an insert iteartor or
something equivalent] that can allow one to perform union, difference,
etc on sets and maps in-place.

E.g. instead of using

set<MyClass> s1, s2, temp;
set_union(
   s1.begin(), s1.end(),
   s2.begin(), s2.end(),
   inserter(temp, temp.begin()));
temp.swap(s2);

i'd like to do, say:

copy(s1.begin(), s1.end(),
   my_unioner(s2, s2.begin()));

which will do s2 = s1 + s2 in LINEAR time.

It's pretty simple to write an inserter like that, but I am just
wondering if there is one already ... or something similar.

Thanks!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net