Suma wrote:

This is more or less a follow up of the previous question I posed yday

:)

I have vectors V1 and V2 and a functor (less_than) for sorting the

vectors.

The vectors hold object pointers (CPerson*,and not objects).

struct Less

{

bool operator()(const CPerson* x, const CPerson* y) const

{

..

}

}

I call sort(V1.begin(),V1.end(),Less()) and sort works OK.No issues

here

I can also sort V2 similiarly

Now I want to compare V1 and V2 - both are now sorted -

What is the best way to do this-given that I already have the logic to

compare individual elements in the vector encoded in the functor?

Of course I can iterate over the elements of V1 and V2 and call a

function that encapsulates the functor logic to compare elements (and

call thatin the functor)

Any inputs will be useful

std::lexicographical_compare(V1.begin() V1.end(), V2.begin(), V2.end(),

Less());

john