This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compile template question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]