[PATCH] libstdc++: Micro-optimization for std::generator helper concept

Tomasz Kaminski tkaminsk@redhat.com
Fri Mar 20 06:29:51 GMT 2026


On Fri, Mar 20, 2026 at 2:16 AM Jonathan Wakely <jwakely@redhat.com> wrote:

> The default_initializable concept is defined in terms of some builtins
> which should be cheap to evaluate. Check that before instantiating the
> allocator_traits class template.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/generator (_Stateless_alloc): Swap order of
>         constraints.
> ---
>
> Tested x86_64-linux.
>
OK.

>
>  libstdc++-v3/include/std/generator | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/generator
> b/libstdc++-v3/include/std/generator
> index 115bf943ae95..88651dd6f76a 100644
> --- a/libstdc++-v3/include/std/generator
> +++ b/libstdc++-v3/include/std/generator
> @@ -423,8 +423,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      };
>
>      template<typename _All>
> -    concept _Stateless_alloc =
> (allocator_traits<_All>::is_always_equal::value
> -                               && default_initializable<_All>);
> +    concept _Stateless_alloc
> +       = default_initializable<_All>
> +           && allocator_traits<_All>::is_always_equal::value;
>
>      template<typename _Allocator>
>        class _Promise_alloc
> --
> 2.53.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260320/eaa0511c/attachment.htm>


More information about the Libstdc++ mailing list