Ben Voigt [C++ MVP]
2009-10-26 17:03:27 UTC
template<typename Object>
typename Database<Object>::Record* // use typename
Database<Object>::Retrieve(const int n)
{
return &items[n];
}
That said, online Comeau compiles you code as is. (I have never really
understood when you need typename...).
It's because you could have a specialization of Database in which Recordtypename Database<Object>::Record* // use typename
Database<Object>::Retrieve(const int n)
{
return &items[n];
}
That said, online Comeau compiles you code as is. (I have never really
understood when you need typename...).
isn't a struct:
template<>
class Database<int> { void Record() { StartRecording(); } };
In the example given, there's no ambiguity, stuff just doesn't work if
Record isn't a type. But this line could either be a function call or a
cast:
Record(x);
This could either be declaration or multiplication (if Record was a
variable):
Record* p;
BTW, a better place for standard (non .NET) C++ questions is
microsoft.public.vc.language
Right. Cross-posting my comments there.microsoft.public.vc.language