If they really need to stay unsorted (which they really donโt do ... and if you are dealing with hundreds of thousands of elements, then I have to ask why you will compare such vectors), you can hack together a comparison method that works with unsorted arrays .
The only way to do this is to create a temporary vector3 and make it set_intersection by adding all the elements of vector1 to it, then search for each individual element of vector2 in vector3 and delete if found. I know this sounds awful, but why am I not writing any standard C ++ libraries in the near future.
In fact, just sort them first.
darvids0n Jun 06 2018-11-06T00: 00Z
source share