J
jason.cipriani
I never seem to be able to get this right. Here I have some code:
template <typename T, int N> class A {
void f (T);
};
template <typename T> void A<T,1>::f (T) {
}
template <typename T> void A<T,3>::f (T) {
}
The goal of that code is to partially specialize A<T,N>::f() for
certain values of N, leaving T unconstrained. The syntax is what I
could pick up from this site:
http://www.cprogramming.com/tutorial/template_specialization.html
This code does not compile. Comeau (using whatever the default
settings are when you go to the test drive site) seems to produce the
clearest errors:
"ComeauTest.c", line 5: error: template argument list must match the
parameter list
template <typename T> void A<T,1>::f (T) {
"ComeauTest.c", line 8: error: template argument list must match the
parameter list
template <typename T> void A<T,3>::f (T) {
I can't seem to massage this into compiling. What is the right syntax
for this?
Thanks!
Jason
template <typename T, int N> class A {
void f (T);
};
template <typename T> void A<T,1>::f (T) {
}
template <typename T> void A<T,3>::f (T) {
}
The goal of that code is to partially specialize A<T,N>::f() for
certain values of N, leaving T unconstrained. The syntax is what I
could pick up from this site:
http://www.cprogramming.com/tutorial/template_specialization.html
This code does not compile. Comeau (using whatever the default
settings are when you go to the test drive site) seems to produce the
clearest errors:
"ComeauTest.c", line 5: error: template argument list must match the
parameter list
template <typename T> void A<T,1>::f (T) {
"ComeauTest.c", line 8: error: template argument list must match the
parameter list
template <typename T> void A<T,3>::f (T) {
I can't seem to massage this into compiling. What is the right syntax
for this?
Thanks!
Jason