Re[8]: MSVC2005 error C2764
От: gear nuke  
Дата: 26.05.06 18:31
Оценка: 1 (1)
Здравствуйте, 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
Re[7]: MSVC2005 error C2764
От: Lorenzo_LAMAS  
Дата: 27.05.06 06:49
Оценка:
V>согласен, а ты никогда таки минусы и не ставил?

Ставил Но, как мне казалось и кажется, все же больше по делу
Of course, the code must be complete enough to compile and link.
Re[8]: MSVC2005 error C2764
От: Vain Россия google.ru
Дата: 28.05.06 14:02
Оценка:
Здравствуйте, Lorenzo_LAMAS, Вы писали:

L_L>Ставил Но, как мне казалось и кажется, все же больше по делу

Ну вот, так я и говорю, что там написано согласен/не согласен, а ты расцениваешь их как прав/не прав..
[In theory there is no difference between theory and practice. In
practice there is.]
[Даю очевидные ответы на риторические вопросы]
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.