Hello,

Would anybody suggest any STL algorithm that works on two ranges applying a predicate.

For example I would like to have the difference of two maps values.

Thanks in advance

predicate versions of std::mismatch std::search std::lexicographical_compare std::equal etc.

#include <algorithm>
#include <functional>
...

transform(
  a.begin(),
  a.end(),
  b.begin(),
  result.begin(),
  minus <pair <foo, bar> > ()
  );

You'll have to define what the difference between two pairs<> is... (by overloading the - operator)

Hope this helps.

Thanks, you have helped me much:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.