Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Templates

Name: Anonymous 2008-10-11 23:49

Sup /prog/.

Learning templates. Devcpp throws this warning:

[Warning] passing `const circle<float>' as `this' argument of `void circle<T>::move(int) [with T = float]' discards qualifiers

Why does passing oneself as a self reference to a member function 'discard qualifiers'? What the hell are qualifiers, and why haven't we met before?

With Love,
Hapless Anon.

Name: Anonymous 2008-10-12 0:16

>>3
Fine. That specific error references:

template<class T>
bool circle<T>::isEqual (const circle<T>& c) const
{
  //first check if the comparison circle is the same size as a self reference
  if(c.size() == this->size())
  {
    int count = 0;
    while(count < this->size())
    {
      if(c.getCurrent() != this->getCurrent())
      {
        this->move(this->size() - count);
        return false;
      }
      c.move(1);
      //THIS LINE
      this->move(1);
      count++;
    }
    return true;
  }
  return false;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List