-->A function template is not a function so we ---can't extract its param. It needs to be instantiated first.
Back to the example:
template<typename T, typename V>
void foo(int) {}
// let's instantiate a function from foo
template void foo<double, char> (int);
So to extract these two template arguments?
Assume we have a primary template:
template <void(*)(int)>
struct A;
What's the specialization that can extract the arguments of foo<double, char>?
-------- Original message --------
From: Anoop Rana <ranaanoop986@gmail.com>
Date: 7/10/24 8:44 PM (GMT+04:00)
To: std-proposals@lists.isocpp.org
Cc: organicoman <organicoman@yahoo.fr>
Subject: Re: [std-proposals] template params of a function template
Also note that a function template cannot be passed as a template template paramater/argument.
---
A function template is not a function so we can't extract its param. It needs to be instantiated first.
Hello Gents,
Given this case:
*****
// primary template
template<void(*)(int)>
struct A;
// specialization
template<typename T, typename V
,template<typename, typename> F
,void (*(F<T,V>)(int)>
struct A<F> { };
******
Why this specialization doesn't compile?
And how to extract the template params of a function template, let say
template<typename T, typename V>
void foo(int) {};
In a templated struct that accepts function pointers, let say
template<void(*)(int)>
struct A { // impl };
Regards
Nadir
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals