template function problem

Denis Nagorny denis_nagorny@linux.intel.com
Fri Feb 17 12:25:00 GMT 2006


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



More information about the Gcc-help mailing list