Date: Tue, 23 Sep 2025 12:46:41 +0200
On 9/23/25 12:30, Keenan Horrigan wrote:
> Neat, thanks.
>
> Would you by chance happen to know if with C++26 reflection, taking a 'std::meta::info' as a template parameter and then using that in a deduction is legal? Something like this:
>
> template<std::meta::info Container>
> using deduced = decltype(
> typename[: Container :](std::from_range, std::vector<int>())
> );
>
> using deduced_from_list = deduced<^^std::list>;
That should work, and the wording is quite non-obtuse for that case:
"A type-specifier is a placeholder for a deduced class type (9.2.9.8) if either
(3.1) ...
(3.2)— it is of the form typename/opt splice-specifier and the splice-specifier designates a class template or alias
template."
> It would definitely be useful though. Not only to possibly circumvent this thing about template template parameters not being deducible templates,
I think we should add that capability soon-ish, but that needs a paper
to make sure we get the mechanics right. Deducible alias templates
are a bit of a nightmare, for example.
> but also so you could accept a wider variety of templates, like templates that accept non-type parameters as well.
Jens
> Neat, thanks.
>
> Would you by chance happen to know if with C++26 reflection, taking a 'std::meta::info' as a template parameter and then using that in a deduction is legal? Something like this:
>
> template<std::meta::info Container>
> using deduced = decltype(
> typename[: Container :](std::from_range, std::vector<int>())
> );
>
> using deduced_from_list = deduced<^^std::list>;
That should work, and the wording is quite non-obtuse for that case:
"A type-specifier is a placeholder for a deduced class type (9.2.9.8) if either
(3.1) ...
(3.2)— it is of the form typename/opt splice-specifier and the splice-specifier designates a class template or alias
template."
> It would definitely be useful though. Not only to possibly circumvent this thing about template template parameters not being deducible templates,
I think we should add that capability soon-ish, but that needs a paper
to make sure we get the mechanics right. Deducible alias templates
are a bit of a nightmare, for example.
> but also so you could accept a wider variety of templates, like templates that accept non-type parameters as well.
Jens
Received on 2025-09-23 10:46:46