Subject: Re: [boost] What to do about std::binary_function and std::unary_function?
From: Rainer Deyke (rainerd_at_[hidden])
Date: 2016-05-06 04:32:19
On 05.05.2016 21:18, Nick Matteo wrote:
> 3) A modification of approach 2: instead of manually adding the
> typedefs everywhere, make a base class to provide the typedefs
> somewhere in Boost. Then replace inheritance from
> std::binary_function<Arg1, Arg2, Result> with inheritance from
> boost::binary_function<Arg1, Arg2, Result>.
3a) Provide boost::binary_function<Arg1, Arg2, Result>, which inherits
std::binary_function<Arg1, Arg2, Result> if it is available, and
reimplements std::binary_function otherwise.
This seems like the least intrusive, most backwards-compatible solution.
Any old code that (for some pathological reason) depends on the use of
std::binary_function will continue to function so long as
std::binary_function exists. Any code that merely depends on the
typedefs that std::binary_function provides will continue to function
indefinitely. All existing boost code can be updated with a simple
search-and-replace, with no decrease in code readability or compactness.
And moving from (3a) to (3) would be a simple change to a single file,
should this change ever become necessary or desirable.
-- Rainer Deyke (rainerd_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk