std::binary_function
Min standard notice:
Header: <functional>
std::binary_function is a base class for creating function objects with two arguments.
# Declarations
template<
class Arg1,
class Arg2,
class Result
> struct binary_function;
(deprecated in C++11) (removed in C++17)
# Example
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
struct same : std::binary_function<int, int, bool>
{
bool operator()(int a, int b) const { return a == b; }
};
int main()
{
std::vector<char> v1{'A', 'B', 'C', 'D', 'E'};
std::vector<char> v2{'E', 'D', 'C', 'B', 'A'};
std::vector<bool> v3(v1.size());
std::transform(v1.begin(), v1.end(), v2.begin(), v3.begin(), std::not2(same()));
std::cout << std::boolalpha;
for (std::size_t i = 0; i < v1.size(); ++i)
std::cout << v1[i] << " != " << v2[i] << " : " << v3[i] << '\n';
}