<div dir="ltr">hi<br><br>i am compiling the following code:<br><br>1:#include &lt;map&gt;<br>2:<br>3:template &lt;class a, class b&gt;<br>4:class c<br>5:{<br>6:      private:<br>7:              b defaultVal;<br>8:      public:<br>

9:              std::map&lt;a,b&gt; mymap;<br>10:             const b &amp;func(a idx)<br>11:             {<br>12:                     std::map&lt;a,b&gt;::iterator it=mymap.find(a);<br>13:                     if (it!=mymap.end())<br>

14:                             return it-&gt;second;<br>15:                     else<br>16:                             return defaultVal;<br>17:             }<br>18:};<br>...<br>...<br><br>compiling it (under cygwin) , i get the following:<br>

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

<br><br>what&#39;s wrong ?<br></div>