частичная специализация шаблона внутри класса
От: innochenti  
Дата: 21.12.11 20:19
Оценка: 4 (1)
#include <iostream>
template<class U, int index>
struct Index
{
        template<class Z, int T> 
        struct Helper;
 
        template<class Z>
        struct Helper<Z,index>
        {
                static const int value = 1;
        };
 
        template<class Z, int T>
        struct Helper
        {
                static const int value = 0;
        };
 
        static const int value = Helper<U,1>::value;
};
 
int main()
{
Index<int,1> j;
std::cout << j.value << std::endl;
return 0;
}


в студии 2010 результат равен 0.
а в http://ideone.com/n1tXs
результат равен 1.

Объясните, пожалуйста, в чем подвох.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.