On 19/09/18 03:59, [email protected] wrote:
This discussion provides an insight into library maintenance issues
associated with Standard C++17; especially with third-party libraries that
require backwards compatibility with both old and new software development
platforms.

What is the best way to provide backwards compatible <functional> STL
templates for std::binary_function and std::unary function?  The Xalan
code base has numerous functions based on the std::unary_function and
std::binary_function templates.

Dear Steven,

There's a simple solution here, which is that to be fully backward compatible, you simply remove their use. There is zero need for them even with C++98; they provide zero functionality. The operator() provided by the functors completely defines the return type and argument type(s). The unary_function and binary_function base class has zero additional benefit, making it completely safe to drop.

Please see these commits:

https://github.com/rleigh-codelibre/xalan-c/commit/62714f6be22ec524aec6548c5368e9f422728ddf
https://github.com/rleigh-codelibre/xalan-c/commit/c05f53f74af60b034e7f7f80863c4098fa1d7f2a
https://github.com/rleigh-codelibre/xalan-c/commit/35465af52a020c2135d9b434428b254feddf34ea

From this branch:
https://github.com/rleigh-codelibre/xalan-c/commits/cmake-build

62714f6 - cleans up some pre-Standard preprocessor stuff
c05f53f - drops all use of unary_function and binary_function
35465af - additional cleanup of result_type and argument_type (retained in the previous commit for strict API compatibility)

All these changes should be compatible with C++98 through to C++17.


Regards,
Roger

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to