C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [[packed]] std::unaligned

From: Oleksandr Pikozh <o.pikozh_at_[hidden]>
Date: Sat, 9 Dec 2023 22:45:34 +0200
> requires' constraint, but I don't think there's a way of doing this that
can take into account whether the argument is an Lvalue or an Rvalue

AFAIK, these is. (And I don't see any reasons to lean from #3.)

On Sat, Dec 9, 2023, 12:30 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
>
> On Sat, Dec 9, 2023 at 1:59 AM Thiago Macieira wrote:
> >
> > Right, because you used templates. But I don't think the standard would
> be
> > that lax in defining the interface.
>
>
> Okay then I think there are four options:
> (1) Just allow my original code to give a compiler error
> (2) Use a 'requires requires' constraint, but I don't think there's a way
> of doing this that can take into account whether the argument is an Lvalue
> or an Rvalue (although maybe this won't matter with a trivial?)
> (3) Use a static_assert(false) with "if constexpr"
> (4) The 'std::unaligned' type has compiler magic that makes it define all
> of the non-const operators that are defined in 'T'.
>
>
> Do you think Option No. 4 is the way to go?
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-12-09 20:45:50