[PATCH] Reimplement __gnu_cxx::__ops operators
François Dumont
frs.dumont@gmail.com
Thu Jun 15 05:07:35 GMT 2023
I think we all agree that __gnu_cxx::__ops needed to be reimplemented,
here it is.
Note that I kept the usage of std::ref in <string>, <vector> and <deque>.
libstdc++: Reimplement __gnu_cxx::__ops operators
Replace functors using iterators as input to adopt functors that
are matching the same Standard expectations as the ones imposed on
predicates used in predicates-aware algos. Doing so we need far less
functors. It impose that iterators are dereference at algo level and
not in the functors anymore.
libstdc++-v3/ChangeLog:
* include/std/functional (_Not_fn): Move to...
* include/bits/predefined_ops.h: ...here, and expose a version
in pre-C++14 mode.
(__not_fn): New, use latter.
(_Iter_less_iter, _Iter_less_val, _Val_less_iter,
_Iter_equal_to_iter)
(_Iter_equal_to_val, _Iter_comp_iter, _Iter_comp_val,
_Val_comp_iter)
(_Iter_equals_val, _Iter_equals_iter, _Iter_pred,
_Iter_comp_val)
(_Iter_comp_to_val, _Iter_comp_to_iter, _Iter_negate): Remove.
(__iter_less_iter, __iter_less_val, __iter_comp_val,
__val_less_iter)
(__val_comp_iter, __iter_equal_to_iter,
__iter_equal_to_val, __iter_comp_iter)
(__val_comp_iter, __iter_equals_val, __iter_comp_iter,
__pred_iter): Remove.
(_Less, _Equal_to, _Equal_to_val, _Comp_val): New.
(__less, __equal_to, __comp_val): New.
* include/bits/stl_algo.h: Adapt all algos to use new
__gnu_cxx::__ops operators.
When possible use std::move to pass predicates between
routines.
* include/bits/stl_algobase.h: Likewise.
* include/bits/stl_heap.h: Likewise.
* include/std/deque: Cleanup usage of __gnu_cxx::__ops
operators.
* include/std/string: Likewise.
* include/std/vector: Likewise.
Tested under Linux x86_64 normal and _GLIBCXX_DEBUG modes.
Ok to commit ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: predefined_ops.patch
Type: text/x-patch
Size: 89080 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20230615/8759fb8c/attachment-0001.bin>
More information about the Libstdc++
mailing list