> 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@lists.isocpp.org> 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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals