This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: template function problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]