what does g++ want from my code

what does g++ want from my code

Erez D erez0001 at gmail.com
Wed Aug 25 11:29:39 IDT 2010


hi

i am compiling the following code:

1:#include <map>
2:
3:template <class a, class b>
4:class c
5:{
6:      private:
7:              b defaultVal;
8:      public:
9:              std::map<a,b> mymap;
10:             const b &func(a idx)
11:             {
12:                     std::map<a,b>::iterator it=mymap.find(a);
13:                     if (it!=mymap.end())
14:                             return it->second;
15:                     else
16:                             return defaultVal;
17:             }
18:};
...
...

compiling it (under cygwin) , i get the following:

$ g++ -c -o kaka.o kaka.cpp
kaka.cpp: In member function 'const b& c<a, b>::func(a)':
kaka.cpp:12: error: expected `;' before 'it'
kaka.cpp:13: error: 'it' was not declared in this scope


what's wrong ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20100825/66f8ebe6/attachment.html>


More information about the Linux-il mailing list