Date: Wed, 7 May 2025 16:12:16 +0100
On Wed, May 7, 2025 at 2:44 AM Arthur O'Dwyer wrote:
>
> There is; check out the "passkey idiom."
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2893r3.html#passkey-idiom
I read your paper just now. I wonder had you considered excluding
certain classes with a 'requires' clause? Let's say you only want to
be friends with classes that have a 'value' that is a pointer to a
polymorphic class. So where you had:
template<class... Ts>
class Foo {
friend Ts...;
};
Imagine if you could have:
template<class... Ts>
class Foo {
(friend Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >) ). . . ;
};
Something along those lines.
>
> There is; check out the "passkey idiom."
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2893r3.html#passkey-idiom
I read your paper just now. I wonder had you considered excluding
certain classes with a 'requires' clause? Let's say you only want to
be friends with classes that have a 'value' that is a pointer to a
polymorphic class. So where you had:
template<class... Ts>
class Foo {
friend Ts...;
};
Imagine if you could have:
template<class... Ts>
class Foo {
(friend Ts requires (is_pointer_v< Ts::value > &&
is_polymorphic_v< remove_pointer_t<Ts::value> >) ). . . ;
};
Something along those lines.
Received on 2025-05-07 15:12:29