Здравствуйте, MuTPu4, Вы писали:
MTP>MTP>An explicit specialization shall be declared in the namespace of which the template is a member, or, for member templates, in the namespace of which the enclosing class or enclosing class template is a member.
Самое интересное, что MSVC 2005 это не смущает, а проблема у него из-за специализации struct TEST<
const _T>.
Вот такое компилируется:
template<class T>
struct T_TRAITS {
template<int N> struct _SWITCH;
template<> struct _SWITCH<1> {
template<class _T>
struct TEST {
typedef _T TYPE;
};
// template<class _T>
// struct TEST<const _T> {
// typedef _T TYPE;
// };
};
typedef typename _SWITCH<1>::TEST<T>::TYPE TYPE;
};
template<class T>
struct T_TRAITS<const T> {
template<int N> struct _SWITCH;
template<> struct _SWITCH<1> {
template<class _T>
struct TEST {
typedef _T TYPE;
};
};
typedef typename _SWITCH<1>::TEST<T>::TYPE TYPE;
};
typedef T_TRAITS<int>::TYPE TYPE;
int main() {
return 0;
}
EDG frontend ругается, как и ожидалось:
"ComeauTest.c", line 6: error: explicit specialization is not allowed in the
current scope
template<> struct _SWITCH<1> {
^
People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird (c) D.Knuth
V>согласен, а ты никогда таки минусы и не ставил?
Ставил
Но, как мне казалось и кажется, все же больше по делу
Здравствуйте, Lorenzo_LAMAS, Вы писали:
L_L>Ставил Но, как мне казалось и кажется, все же больше по делу
Ну вот, так я и говорю, что там написано согласен/не согласен, а ты расцениваешь их как прав/не прав..
[In theory there is no difference between theory and practice. In
practice there is.]
[Даю очевидные ответы на риторические вопросы]