I have the following function:
ubigint::ubigint (const string& that){
           DEBUGF ('~', "that = \"" << that << "\"");
           for (char digit: that) {
              if (not isdigit (digit)) {
                 throw invalid_argument ("ubigint::ubigint(" + that + ")");
              }
           }
           //string thatCopy = that;
           for(string::reverse_iterator rit = that.rbegin(); rit != that.rend(); rit++) // iterate the string from end to start and store it in the vector
            {
                ubig_value.push_back(*rit); // push the character
            }  
        }
and I am getting the following error
 error: no matching function for call to ‘__gnu_cxx::__normal_iterator
I created a copy of the string that in the function and this solved the problem
ubigint::ubigint (const string& that){
   DEBUGF ('~', "that = \"" << that << "\"");
   for (char digit: that) {
      if (not isdigit (digit)) {
         throw invalid_argument ("ubigint::ubigint(" + that + ")");
      }
   }
   string thatCopy = that;
   for(string::reverse_iterator rit = thatCopy.rbegin(); rit != thatCopy.rend(); rit++) // iterate the string from end to start and store it in the vector
    {
        ubig_value.push_back(*rit); // push the character
    }  
}
why does that happen?. Am I not allowed to iterate over constant strings?
