This is the mail archive of the
mailing list for the GCC project.
Re: compile template question
- From: Nathan Sidwell <nathan at acm dot org>
- To: chenzero <chenzero at netease dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 2 Dec 2016 10:07:54 -0500
- Subject: Re: compile template question
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org>
On 12/02/2016 07:12 AM, chenzero wrote:
I have following code,
in gcc 4.8.4, the code can NOT compile, because of an error:
error: need ‘typename’ before ‘std::map<K, V>::iterator’ because
‘std::map<K, V>’ is a dependent scope
however, I can compile the same code in other C++ compiler(borland c++),
whether there are some differences between gcc template syntax?
Your code requires the typename. See 14.6.2 of the std for reasons.