[PATCH][V2] Reimplement __gnu_cxx::__ops operators

Jonathan Wakely jwakely@redhat.com
Thu Sep 11 06:57:12 GMT 2025


On Thu, 11 Sept 2025 at 06:16, François Dumont <frs.dumont@gmail.com> wrote:
>
>
> On 9/9/25 01:52, Jonathan Wakely wrote:
> > On Mon, 8 Sept 2025 at 21:06, Jonathan Wakely <jwakely@redhat.com> wrote:
> >> On Mon, 8 Sept 2025 at 20:59, François Dumont <frs.dumont@gmail.com> wrote:
> >>> This is V2 of this patch. Main diff with initial version is that I
> >>> restored the copy of functors in C++98.
> >>>
> >>> I'm all ears for a new name for the _GLIBCXX_CP_FWDREF macros.
> >> Great, I was going to ask you about the status of this patch. I'll
> >> take a look ASAP.
> > It seems to be three changes all bundled together into one patch,
> > replacing the __iter_comp_iter wrappers, reducing the number of copies
> > of functors, and changing lower_bound/upper_bound internals to work
> > with non-const values.
> >
> > The first two changes are good, but should be separate commits, and I
> > don't think the third is needed.
>
> The third is minor indeed, it's yet another attempt to reduce constraint
> on functor arguments const qualifications.
>
> You initially were concern by my patch imposing functors' operator() to
> be const qualified so I thought it mattered also here.
>
> >
> > My approach for the first change seems simpler:
> > https://forge.sourceware.org/gcc/gcc-TEST/compare/trunk...redi:remove-predefined-ops
> >
> Indeed, good idea to reuse Standard libs bits for the >= C++11 mode.
>
> Do you plan to submit it and open a PR soon ?

Yes, probably later today, now that I've submitted another one for
fixing iterator arithmetic in <algorithm>.

> Just 1 remark, despite being in __gnu_cxx::__ops namespace shouldn't
> 'less' or 'equal_to' names be uglyfied ?

There's no reason to, the names 'less' and 'equal_to' are used in the
standard library so nobody can define macros with those names.

>
> I better focus on the second part then, I'll split it.
>
>



More information about the Libstdc++ mailing list