Date: Thu, 8 May 2025 09:33:57 +0100
On Wed, May 7, 2025 at 7:15 PM Arthur O'Dwyer wrote:
>
> On Wed, May 7, 2025 at 11:12 AM Frederick Virchanza Gotham wrote:
>>
>> (friend Ts requires (is_pointer_v< Ts::value > && is_polymorphic_v< remove_pointer_t<Ts::value> >) ). . . ;
>
> That thing with the parentheses isn't remotely how C++'s declaration grammar works, though, so, no.
So then maybe start with "friend..." and put everything in parentheses
afterward, like this:
friend... Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >)
or maybe start with "friend" followed by what looks like a fold statement:
friend (Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >))...
I asked AI to give me a two more syntaxes:
friend requires (is_pointer_v<Ts::value> &&
is_polymorphic_v<remove_pointer_t<Ts::value>>) Ts...;
friend Ts... requires (is_pointer_v<Ts::value> &&
is_polymorphic_v<remove_pointer_t<Ts::value>>);
And then of course you could always use "enable_if" instead of "requires".
>
> On Wed, May 7, 2025 at 11:12 AM Frederick Virchanza Gotham wrote:
>>
>> (friend Ts requires (is_pointer_v< Ts::value > && is_polymorphic_v< remove_pointer_t<Ts::value> >) ). . . ;
>
> That thing with the parentheses isn't remotely how C++'s declaration grammar works, though, so, no.
So then maybe start with "friend..." and put everything in parentheses
afterward, like this:
friend... Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >)
or maybe start with "friend" followed by what looks like a fold statement:
friend (Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >))...
I asked AI to give me a two more syntaxes:
friend requires (is_pointer_v<Ts::value> &&
is_polymorphic_v<remove_pointer_t<Ts::value>>) Ts...;
friend Ts... requires (is_pointer_v<Ts::value> &&
is_polymorphic_v<remove_pointer_t<Ts::value>>);
And then of course you could always use "enable_if" instead of "requires".
Received on 2025-05-08 08:34:09