Date: Sun, 15 Mar 2026 19:49:23 +0200
On Sun, 15 Mar 2026 at 14:00, <std-proposals-request_at_[hidden]>
wrote:
> I would expect an interface that avoids "typename" and "::type",
> e.g. employing an alias template.
>
Thank you for the suggestion. This has been implemented using a _t suffix
alias template following the convention in <type_traits>.
> Do we get subsumption, i.e.
>
> f(is_real auto)
>
> is more specialized than
>
> f(is_number auto)
>
> ?
>
> If not, that feels like causing a bad bang-for-the-buck ratio
> of this facility.
>
> Jens
Native subsumption is not achievable in a library pure form since it
requires concept relationships that the compiler can trace.
Subsumption could be added if this method is pursued for language level
implementation.
Would fold expressions make this more readable?
>
> ```cpp
> template<typename T, typename... Ts>
> concept any_of = (std::same_as<T, Ts> || ...);
>
> template<typename T>
> concept natural_number = any_of<T, unsigned char, unsigned short,
> unsigned int, unsigned long,
> unsigned long long>;
> ```
>
For simple flat constraints any_of works well and I would recommend it for
that case.
The advantage of merge_tags_and_types_t is that deduplication is paid once
at definition time, duplicate types across merged lists are collapsed into
a single instantiation, whereas merging two any_of concepts has no
equivalent mechanism.
wrote:
> I would expect an interface that avoids "typename" and "::type",
> e.g. employing an alias template.
>
Thank you for the suggestion. This has been implemented using a _t suffix
alias template following the convention in <type_traits>.
> Do we get subsumption, i.e.
>
> f(is_real auto)
>
> is more specialized than
>
> f(is_number auto)
>
> ?
>
> If not, that feels like causing a bad bang-for-the-buck ratio
> of this facility.
>
> Jens
Native subsumption is not achievable in a library pure form since it
requires concept relationships that the compiler can trace.
Subsumption could be added if this method is pursued for language level
implementation.
Would fold expressions make this more readable?
>
> ```cpp
> template<typename T, typename... Ts>
> concept any_of = (std::same_as<T, Ts> || ...);
>
> template<typename T>
> concept natural_number = any_of<T, unsigned char, unsigned short,
> unsigned int, unsigned long,
> unsigned long long>;
> ```
>
For simple flat constraints any_of works well and I would recommend it for
that case.
The advantage of merge_tags_and_types_t is that deduplication is paid once
at definition time, duplicate types across merged lists are collapsed into
a single instantiation, whereas merging two any_of concepts has no
equivalent mechanism.
Received on 2026-03-15 17:49:36
