compile template question

Nathan Sidwell nathan@acm.org
Fri Dec 2 15:07:00 GMT 2016


On 12/02/2016 07:12 AM, chenzero wrote:
> Hello,
>
> 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.

nathan

-- 
Nathan Sidwell



More information about the Gcc mailing list