Re: Template Bug?
Re: Template Bug?
- Subject: Re: Template Bug?
- From: David Rowland <email@hidden>
- Date: Fri, 24 Aug 2007 18:38:26 -0700
Willy P wrote:
Not certain that this is the right list to be posting this problem but
here goes:
template< class T >
void createCompilerError()
{
T::iterator pos;
}
gives me this error:
error: expected `;' before 'pos'
I thought that was legal C++ and I have word that it works on MSVC-2005.
This is a somewhat arcane point. "iterator" is a qualified name,
dependent on the meaning of T. Since the compiler cannot know the
structure of T on first encountering this code, it insists that
typenames be called such, using the keyword "typename". You must write
it as,
template< class T >
void createCompilerError()
{
typename T::iterator pos;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden