[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Specialization of template class with inner template members
From: |
David Lazanja |
Subject: |
Specialization of template class with inner template members |
Date: |
Fri, 30 Sep 2005 16:39:33 -0400 |
User-agent: |
KMail/1.8 |
Someone posted a message about this on Dec. 10 2004.
Please compare Example 2 to Examples 8 and 9.
Also, is Example 6 doing the right thing.
Pass == no compile errors
Fail == compile errors.
Thanks
David
// -------------------------------------------
// problems here
template<class S>
class Orange {
template<class T> void peal(T& x);
template<class T> void squeeze();
template<class T> struct Peach;
};
// Ex. 1
// Pass
template<class S> template<class T>
struct Orange<S>::Peach {
};
// Ex. 2
// Pass
// compare this to Ex. 8 and Ex. 9 below
template<> template<class T>
struct Orange<int>::Peach {
};
// Ex. 3
// Pass
template<> template<>
struct Orange<int>::Peach<double>{
};
// Ex. 4
// Fail
template<class T> template<>
struct Orange<T>::Peach<double>{
};
// Ex. 5
// Pass
template<class S> template<class T>
void Orange<S>::peal(T& x) {
}
// Ex. 6
// Fail
// This does not work (found a reference at IBM:)
template<class S> template<>
void Orange<S>::peal<double>() {
}
// Ex. 7
// Pass
template<> template<>
void Orange<int>::peal<int>(int& x) {
}
// Ex. 8
// Pass
// This works but Ex. 9 fails.
template<> template<class T>
void Orange<int>::peal(T& x) {
}
// Ex. 9
// Fail
template<> template<class T>
void Orange<int>::squeeze() {
}
// -------------------------------------------
int main() {
return 0;
}
--
# Department of Applied Physics and Applied Mathematics
# Columbia University
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Specialization of template class with inner template members,
David Lazanja <=