This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch compilers-101
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 6eef5c492171e1ca28ab824400350bb58a9b9074
Author: Pedro F. Giffuni <[email protected]>
AuthorDate: Sat Nov 7 02:28:17 2026 -0500

    Fix stl/functional for C++17: restore unary_function/binary_function
    
    std::unary_function and std::binary_function were removed in C++17,
    but the SGI emulation header inherits from them for identity,
    select1st, select2nd, project2nd, and unary_compose.
    Define them ourselves when __cplusplus >= 201703L so the source
    files using these extensions continue to compile.
---
 main/stlport/systemstl/functional | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/main/stlport/systemstl/functional 
b/main/stlport/systemstl/functional
index 36a044c199..11785cfce4 100644
--- a/main/stlport/systemstl/functional
+++ b/main/stlport/systemstl/functional
@@ -43,6 +43,23 @@
 #endif 
 #elif defined(__cplusplus) && (__cplusplus >= 201103L)
     #include_next <functional>
+#if __cplusplus >= 201703L
+    // std::unary_function and std::binary_function were removed in C++17,
+    // but the SGI emulation below inherits from them.
+    namespace std {
+    template<typename Arg, typename Result>
+    struct unary_function {
+        using argument_type = Arg;
+        using result_type = Result;
+    };
+    template<typename Arg1, typename Arg2, typename Result>
+    struct binary_function {
+        using first_argument_type = Arg1;
+        using second_argument_type = Arg2;
+        using result_type = Result;
+    };
+    }
+#endif // C++17
 #else // fall back to boost/tr1
        #include <boost/tr1/tr1/functional>
        #include <boost/functional/hash.hpp>

Reply via email to