constの意味あるの…?
class Hoge
{
private:
// メンバ変数は数百あるが全てmutable
mutable int x;
public:
// メンバ関数全てconst指定
void move()const
{
x += 100;
}
void func()const
{
x = 100;
}
};
void MoveHoge( const Hoge& foo )
{
foo.move();
}
int main()
{
Hoge hoge;
MoveHoge( hoge );
return 0;
}
const Hoge hoge; としても MoveHoge が使えるようにしたんですね。分かります。せっかくだから、operator= も constメンバ関数として定義しましょう。
mutableの使いどころが分からない、設計ミスでは?