[`std::binary_function`](https://en.cppreference.com/w/cpp/utility/functional/binary_function) is deprecated now and is going to be deleted in [c++17](/questions/tagged/c%2b%2b17 "show questions tagged 'c++17'"). I searched on different publications, but I couldn't find a exact way to replace it. I'd like to know how should I write the following code in [c++11](/questions/tagged/c%2b%2b11 "show questions tagged 'c++11'") style.

```cpp
template <class T>
inline T absolute(const T &x) {
    return (x >= 0) ? x : -x;
}

template <class T>
struct absoluteLess : public std::binary_function<T, T, bool> {
    bool operator()(const T &x, const T &y) const {
        return absolute(x) < absolute(y);
    }
};

template <class T>
struct absoluteGreater : public std::binary_function<T, T, bool> {
    bool operator()(T &x, T &y) const {
        return absolute(x) > absolute(y);
    }
};

```

### EDIT

I'm using the functions in the following way:

```cpp
output[j] = *std::max_element(input.begin() + prev,
                              input.begin() + pos,
                              absoluteLess<float>());

```

`input` and `output` are `std::vector`s, inside a for-loop.