IntPtr search(const std::string& key)<br>{<br>�� IntPtr i;<br>�� MapTable::const_iterator it = mt.find(key);<br> � �if (it != mt.end()) {<br> � � � � i = it->second; // can't compile it??<br> � �}<br> �� return i;<br>}<br><br><br> <br><br><div class="gmail_quote">On Tue, Dec 1, 2009 at 8:12 PM, hce <span dir="ltr"><<a href="mailto:webmail.hce@gmail.com" target="_blank">webmail.hce@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi,<br> <br> I defined a shared_ptr in to a map table. How can I return a NULL<br> pointer in a function to search the table if it is not found as<br> following example?<br> <br> typedef shared_ptr<int> IntPtr;<br> typedef std::map<std::string IntPtr> MapTable;<br> <br> MapTable mt;<br> <br> IntPtr search(const std::string& key)<br> {<br> � �MapTable::const_iterator it = mt.find(key);<br> � �if (it == mt.end()) {<br> � � � � return NULL; // can't compile it??<br> � �}<br> � �return it->second;<br> }<br> <br> Thank you.<br> <br> Kind regards,<br> <br> Jupiter<br> _______________________________________________<br> Boost-users mailing list<br> <a href="mailto:Boost-users@lists.boost.org" target="_blank">Boost-users@lists.boost.org</a><br> <a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br> </blockquote></div><br>