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

Pages: 1-

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-11 23:56

Fuck shapes, man. Everyone fucking uses shapes to explain polymorphism. You know what I think? I think fuck shapes. Nobody ever fucking really uses shapes in real software. And if they do, they sure as fuck don't create them in the Sepples.

Come back when you become an EXPERT /prog/rammer.

Fuckin' shapes.

Name: Anonymous 2008-10-12 0:07

>>1
sepples
Now you have two problems.

Also we're not going to help you unless you post some fucking code which produces the goddamn error, because no one fucking uses that pile of shit min-gw.

Name: Anonymous 2008-10-12 0:11

>>1
const is a qualifier. lern2c

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;
}

Name: Anonymous 2008-10-12 0:26

Lol the penny drops. Calling move() changes this, which I qualified as const in the prototype. Hence, the qualifier is discarded.

Fuck you >>3, and fuck your sepples.

Name: Anonymous 2008-10-12 0:43

>>5
isEqual
Bjarne fucking gave you operator== you fucking nitwit, use it. sepples is shit, but at least it isn't Java.

Name: Anonymous 2008-10-12 0:46

>>7
Actually it is Java.

Name: Anonymous 2008-10-12 1:10

>>7
It's an assignment. I don't really have a choice in not overloading ==. They just give me the prototypes, and I implement them.

Name: Anonymous 2008-10-12 1:32

>>8
Fuck you, I was actually confused for a second there.

>>9
Shit assignment. You should kick your TA/Professor in the balls for being a fucking idiot. It will mostly likely be the first of many such kicks.

Name: Anonymous 2008-10-12 1:41

>>10
I know. The convenor is a suspected male->female transgender though, so theres no balls to kick.

The assignment is full of holes, and, for a course where one of the core concepts is function and operator overloading, it doesn't include a single case.

Take for example the problem I had in the first place. Unless you guys know something I don't (likely), we have to pop and push our way through each of the queues using the class wrappers, sequentially checking equality of the front elements (see >>5; have to do it this way because the queues are private); ofcourse doing that changes the queue, but the function is const. Compiler shits a brick.

Name: ​​​​​​​​​​ 2010-10-23 20:26

Name: Anonymous 2011-02-04 18:33


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