Date: Sat, 11 Nov 2023 04:53:30 +0200
On Sat, 11 Nov 2023 at 04:47, Jason McKesson via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> On Fri, Nov 10, 2023 at 7:15 PM Ville Voutilainen
> <ville.voutilainen_at_[hidden]> wrote:
> >
> > On Sat, 11 Nov 2023 at 01:53, Jason McKesson via Std-Discussion
> > <std-discussion_at_[hidden]> wrote:
> >
> > > Yes, types like `tuple` *could* override the default behavior, but to
> > > be honest, it would be kind of weird for a C++ standard library
> > > aggregate type to behave so differently from a C++ language aggregate
> > > type. `tuple<not_null>` should behave the same as `container`.
> >
> > Tuple doesn't, it does override the "default" behavior, intentionally.
>
> It doesn't seem to. Link: https://gcc.godbolt.org/z/acrE8Mh9q
>
> That was the behavior I was talking about.
Cool, there's no difference here. There is a difference for certain
reference cases, because
tuple, being a non-aggregate, can't extend lifetimes like plain
aggregates do, so it chooses
to avoid cases that can cause immediate dangling. In such cases, tuple
might well copy
an object from an rvalue. If the type tries to make that ill-formed,
tuple will not care - intentionally.
<std-discussion_at_[hidden]> wrote:
>
> On Fri, Nov 10, 2023 at 7:15 PM Ville Voutilainen
> <ville.voutilainen_at_[hidden]> wrote:
> >
> > On Sat, 11 Nov 2023 at 01:53, Jason McKesson via Std-Discussion
> > <std-discussion_at_[hidden]> wrote:
> >
> > > Yes, types like `tuple` *could* override the default behavior, but to
> > > be honest, it would be kind of weird for a C++ standard library
> > > aggregate type to behave so differently from a C++ language aggregate
> > > type. `tuple<not_null>` should behave the same as `container`.
> >
> > Tuple doesn't, it does override the "default" behavior, intentionally.
>
> It doesn't seem to. Link: https://gcc.godbolt.org/z/acrE8Mh9q
>
> That was the behavior I was talking about.
Cool, there's no difference here. There is a difference for certain
reference cases, because
tuple, being a non-aggregate, can't extend lifetimes like plain
aggregates do, so it chooses
to avoid cases that can cause immediate dangling. In such cases, tuple
might well copy
an object from an rvalue. If the type tries to make that ill-formed,
tuple will not care - intentionally.
Received on 2023-11-11 02:53:44