On Nov 5, 2016, at 5:01 PM, Andrey Semashev
On 11/05/16 22:21, Marshall Clow wrote:
Other vendors will be removing these types in C++17 mode in the future
A quick grep for these terms found 153 instances of "std::unary_function" and 118 of "std::binary_function" across several libraries
I think that we ought to have a boost-wide solution for this (i.e, everyone should solve this the same way).
I can think of three possibilities: * Deny, deny, deny: Boost doesn't work with C++17. Not my recommendation. * Since std::unary|binary_function is an empty struct with a set of two (or three) typedefs, just define the typedefs everywhere. Note that the typedefs (result_type, first_argument_type, second_argument_type) were deemed to not be useful in C++17 due to the existence of advanced type traits, etc. * Define a boost:unary_function and boost::binary_function struct that mimics the one that was in namespace std, and change over to use that. * Something else.
Comments?
#1 is obviously a non-starter. #3 requires changing the same number of use sites as #2, with the minor one-time advantage of requiring only a trivial search/replace operation, but at the cost of adding a new component.
I'm in favor of replacing the structs with typedefs (i.e. option #2).
I agree. I did this some time ago to my own code (to reduce the length of translation units by not including <functional>) and found the result more readable. Josh