compile template question
Jonathan Wakely
jwakely.gcc@gmail.com
Fri Dec 2 12:54:00 GMT 2016
On 2 December 2016 at 12:12, 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?
>
> Thank you very much!
As explained at https://gcc.gnu.org/lists.html the gcc@gcc.gnu.org
mailing list is for discussion of GCC development. If you want help
using GCC please use the gcc-help list instead. I have redirected your
question there.
GCC supports standard C++, which says your code is not valid, for the
reasons GCC gave you in the error messages.
See https://womble.decadent.org.uk/c++/template-faq.html#disambiguation
for an explanation.
More information about the Gcc-help
mailing list