0

Im doing a hashing function, and it wont compile, I copied the function below. Thank you for your help, and excuse my english

template <class Object>
bool FHhashSC<Object>::contains(const Object & x) const
{
   const FHlist<Object> &theList = mLists[myHash(x)];
   typename FHlist<Object>::iterator iter;

   for (iter = theList.begin(); iter != theList.end(); iter++)
      if (*iter == x)
         return true;

   // not found
   return false;
}

You will likely want to use string.match for the parsing and os.time and os.date to construct the correct new time string (os.time to handle converting your new added date into the correct month/year and os.date to turn the time returned by os.time into a human-friendly string/table again) to do your date check looping/stopping.

4

1 回答 1

2

您应该使用 const_iterator 因为 theList 是一个常量对象。

于 2013-11-04T20:20:39.280 回答