I have an enum nested in an object and I am unsuccessfully trying to increment it to the next value.
Here's the classes:
Code:
class Instruction
{
public:
Instruction(uint pc, uint op, int dest, int src1, int src2);
~Instruction();
enum Stages {IF = 0, ID, IS, EX, WB, RET};
Stages stage() const;
void incrementStage();
bool operator==(const Instruction right);
bool operator==( Instruction::Stages &rs );
Stages operator++();
private:
Stages curr_stage;
};
And what I think is the closest to correct that I've done:
Code:
inline Instruction::Stages operator++(Instruction::Stages rs)
{
return (Instruction::Stages)(rs + 1);
}
I am attempting to make prefix work but pre or post will be fine.
Here is the error I am getting: error: no match for ‘operator++’ in ‘++((Instruction*)this)->Instruction::curr_stage’|