look at this sample:
struct parent
{
template <typename t>
inline static t get_t();
};
struct child : public parent
{
template <typename t>
inline static t get_t()
{
return t(-1);
}
};
template <typename t>
struct call
{
inline static int get_value()
{
return t::get_t<int>();
}
};
typedef call< child > test;
int main()
{
int v = test::get_value();
}
The code compile with the following error:
In static member function 'static int call<t>::get_value()':
error: expected primary-expression before 'int'
error: expected ';' before 'int'
error: expected unqualified-id before '>' token
When i compiled the code with visual c++ 2008 and Intel C++ it compiles without problem.
What that error mean?
just add
keyword:
You need the template qualifier:
See:
Where and why do I have to put the "template" and "typename" keywords?