Re: compile template question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I will check carefully the mailing list in future.
currently, I am confused because the same code can be compiled in C++Builder and Visual studio 2008, but not gcc.
I will carefully check the link you posted a little later.
Thanks!


On 2016年12月02日 20:54, Jonathan Wakely wrote:
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@xxxxxxxxxxx
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.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux