C++相談室 part69at TECH
C++相談室 part69 - 暇つぶし2ch645:デフォルトの名無しさん
09/05/30 23:24:24
Effective C++でconst_castはoperator[]の定義で使うことがあるみたいに書いてあったよね?
URLリンク(ritaz.blog64.fc2.com)
より引用。

class sample
{
public:
...;
const char& operator[](unsigned int position) const
{
...;
return dat[position];
}
char& operator[](unsigned int position)
{
return const_cast<char&>(static_cast<const sample&>(*this)[position]);
}
...;
};



次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch