[PATCH] Replace __gnu_cxx::__ops::__negate with std::not_fn

François Dumont frs.dumont@gmail.com
Mon May 22 20:50:54 GMT 2023


I was thinking that it might be nice to get rid of predefined_ops.h content.

So here is a start with __negate. Drawback is that stl_algo.h has to 
include <functional>. For now I just get rid of stl_algo.h include in 
<functional> to rather use stl_algobase.h. But maybe it would be better 
to also isolate std::not_fn in a dedicated header file so that 
stl_algo.h do not have to include all <functional>.

     libstdc++: Replace __gnu_cxx::__ops::__negate with std::not_fn

     Replace the internal __gnu_cxx::__ops::__negate function and associated
     __gnu_cxx::__ops::_Iter_negate by the C++17 std::not_fn.

     libstdc++-v3/ChangeLog:

             * include/bits/predefined_ops.h: Include <version>.
             [__cpp_lib_not_fn](__gnu_cxx::__ops::_Iter_negate): Remove.
             [__cpp_lib_not_fn](__gnu_cxx::__ops::__negate): Remove.
             * include/bits/stl_algo.h: Include <functional> for C++17 
and later.
             [__cpp_lib_not_fn](__find_if_not): Use std::not_fn.
             (std::__search, std::search(_FwdIt1, _FwdIt1, _FwdIt2, 
_FwdIt2, _BinPred)): Move...
             * include/bits/stl_algobase.h: ...here.
             * include/std/functional: Replace <stl_algo.h> include by 
<stl_algobase.h>.

Tests still running.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: predefined_ops.patch
Type: text/x-patch
Size: 9636 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20230522/df0909aa/attachment.bin>


More information about the Libstdc++ mailing list