This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: template function problem
- From: Denis Nagorny <denis_nagorny at linux dot intel dot com>
- To: Alex <aleksei at andevis dot ee>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 17 Feb 2006 15:25:00 +0300
- Subject: Re: template function problem
- References: <014b01c582e4$977356c0$0c2da8c0@TALWS007>
Alex wrote:
Hello All!
Can you take me advice , where can be problem:
in my one hpp file resides folows teplatezy fynction
It can be compiled with the following changes.
#include <map>
using namespace std;
template < class Key, class Value >
Value * map_find (const Key & key, const std::map < Key, Value * >&m)
{ // ^^^
typename std::map < Key, Value * >::const_iterator i = m.find (key);
//^^^^^^^^
if (i == m.end ())
return (Value *) 0;
else
return i->second;
return (Value *) 0;
}
Denis