std::binary_function and std::unary_function are deprecated, and
scheduled to be removed from the standard in C++17. That means it's
possible that code using these might soon fail to compile when
targeting this standard.
These are still used throughout Boost, including by the libraries
Accumulators, Algorithm, Bimap, Function, Functional, GIL, Graph, ICL,
MPI, Polygon, and Xpressive. You can see all the uses I found in the
1.61 beta boost/ directory at
http://kundor.github.io/ubinary_function_list.html .
All that these classes do are provide the typedefs result_type, and
argument_type (for unary_function) or first_argument_type and
second_argument_type (for binary_function).
In particular, they do not include a virtual operator(), so that one
cannot accept a function object polymorphically as a
std::binary_function&, for example.
So, although it is conceivable that C++98-era user code might check
for inheritance from std::binary_function, it seems rather unlikely:
practically all uses should just depend on the typedefs being present
(which is what the standard library has always done).
With modern C++ standards, the availability of std::result_of,
decltype, and std::function make these typedefs redundant, and
references to them are being phased out of the standard library
(starting with deprecation.)
It seems to me that there are four main possibilities for removing
these classes from Boost. (I'll talk about binary_function in the
following, but it all applies equally to unary_function.)
1) Add some sort of compatibility macro to Boost.Config, to enable
classes to inherit from std::binary_function if it is available, or
add the appropriate typedefs if it is not.
I don't think this is necessary.
2) Remove the inheritance from std::binary_function, and add the typedefs.
This seems to be the default approach: it is used by the C++11
standard itself, and has also already been done by some Boost
libraries, e.g. in container/string.hpp and in
intrusive/priority_compare.hpp.
The drawback here is increased verbosity. Instead of writing
template <class T>
struct functor : std::binary_function