[ ratep90 @ 05.02.2011. 20:00 ] @
Pokusavam napraviviti kontejner hash tabelu, ali dobijam slijedecu gresku od kompajlera: warning C4346: 'htabela<KEY,VALUE,CAP>::par' : dependent name is not a type 1> prefix with 'typename' to indicate a type Koristim VS 2010 c++ kompajler. Greska se tice zaglavlja funkcije "nadji". //Interfejs klase i definicija funkcije "nadji" namespace {const int n=97; } template<class KEY,class VALUE,int CAP> class htabela{ struct par{ KEY prvi; VALUE drugi; bool stanje; par():stanje(false){} }; par* tab; void kopiraj(const htabela&); void brisi(){delete []tab;} public: htabela(); void dodaj(const KEY&,const VALUE&); void brisi(const KEY&); const par& nadji(const KEY&); htabela& operator=(const htabela&); htabela(htabela& h){brisi(); kopiraj(h);} ~htabela(){brisi();} }; template<class KEY,class VALUE,int CAP> const htabela<KEY,VALUE,CAP>::par& htabela<KEY,VALUE,CAP>::nadji(const KEY& key) { int trans_key=key; int i=0; while(tab[trans_key%n].prvi!=key && i<CAP) trans_key+=i++; if(i==CAP) throw "KLJUC NE POSTOJI"; return tab[trans_key%n]; } Gdje grijesim? |