Re: GCC 3.4.6 to GCC 4.1.1 migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can you give a complete code sample?

Nasredine Semmar schrieb:
Le vendredi 25 mai 2007 13:53, vous avez écrit :

It's the STL Find function but the compiler does not recognize it.

I added #include <algorithm> but I got the same error.
Here is the class where the function find is called:

#if __GNUC__>2 #include <ext/hash_map>
using __gnu_cxx::hash_map;
using __gnu_cxx::hash;
#else
#include <hash_map>
#endif
template<class A,class B>
class leda_h_array : public MY_HASH_BASE
{
private:
  B init;
public:
  leda_h_array() {}
  leda_h_array(const B&_init)
    : MY_HASH_BASE(),init(_init) {}
  bool defined(const A&a) const
    { return find(a)!= this->end(); }
  const B&operator[](const A&a)const
{ typename MY_HASH_BASE::const_iterator pos=find(a); if( pos== this->end() )
	return init;
      else
	return pos->second;
    }
  B&operator[](const A&a)
{ typename MY_HASH_BASE::iterator pos=find(a);
      if( pos== this->end() )
	{
	  insert(typename MY_HASH_BASE::value_type(a,init));
	  pos=find(a);
	  iassert(pos!= this->end());
	}
      return pos->second;
    }
};

Thanks,

Nasredine



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux