On Wed, 17 Jan 2024, 02:37 Patrick Palka, <ppa...@redhat.com> wrote:

> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
>

OK



> -- >8 --
>
> This compile-time and diagnostic improvement[1] is less important in
> C++23 mode where deducing this is available and used in _Pipe, but for
> benefit of C++20 mode and for consistency let's set the flag on the most
> recently added range adaptors which lack it.
>
> [1]: Defining _S_has_simple_call_op=true for a range adaptor closure
> object signals that the adaptor has an operator() that's not overloaded
> according to the constness/value category of the object, which in turn
> allows us to implement the operator() of the composition of such adaptors
> in a simpler way.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/ranges (views::_Adjacent::_S_has_simple_call_op):
>         Define to true.
>         (views::_AsRvalue::_S_has_simple_call_op): Likewise.
>         (views::_Enumerate::_S_has_simple_call_op): Likewise.
>         (views::_AsConst::_S_has_simple_call_op): Likewise.
> ---
>  libstdc++-v3/include/std/ranges | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/ranges
> b/libstdc++-v3/include/std/ranges
> index 7ef835f486a..66502cc1da4 100644
> --- a/libstdc++-v3/include/std/ranges
> +++ b/libstdc++-v3/include/std/ranges
> @@ -5669,6 +5669,8 @@ namespace views::__adaptor
>             else
>               return adjacent_view<all_t<_Range>,
> _Nm>(std::forward<_Range>(__r));
>           }
> +
> +       static constexpr bool _S_has_simple_call_op = true;
>        };
>
>      template<size_t _Nm>
> @@ -8844,6 +8846,8 @@ namespace views::__adaptor
>           else
>             return as_rvalue_view(std::forward<_Range>(__r));
>         }
> +
> +      static constexpr bool _S_has_simple_call_op = true;
>      };
>
>      inline constexpr _AsRvalue as_rvalue;
> @@ -9147,6 +9151,8 @@ namespace views::__adaptor
>         constexpr auto
>         operator() [[nodiscard]] (_Range&& __r) const
>         { return enumerate_view<all_t<_Range>>(std::forward<_Range>(__r));
> }
> +
> +      static constexpr bool _S_has_simple_call_op = true;
>      };
>
>      inline constexpr _Enumerate enumerate;
> @@ -9253,6 +9259,8 @@ namespace views::__adaptor
>         else
>           return as_const_view(std::forward<_Range>(__r));
>        }
> +
> +      static constexpr bool _S_has_simple_call_op = true;
>      };
>
>      inline constexpr _AsConst as_const;
> --
> 2.43.0.367.g186b115d30
>
>

Reply via email to