I've got the following code:
The following line always gives me an error saying ';' expected before find_occur.Code:template <typename T> int Histogram<T>::get_occurances(const T& obj) { map<T,int>::iterator find_occur = frequency.find(obj); if ( find_occur == this->frequency.end() ) { return 0; } return ( find_occur->second ); }
map<T,int>::iterator find_occur = frequency.find(obj);
If I change the first argument of the map to something other than T, then it works fine, but I need the template type. Is there something I'm doing wrong?




Reply With Quote