C++ の safe-bool イディオムに必要なすべてのプロパティが含まれていることを保証するために、クラスを提出する必要がある単体テストはどれですか?
それらすべてに名前を付けようとすると ( The Safe Bool Idiomから抽出)、おそらく safe-bool イディオムを実装test
するクラスのインスタンスについて、次の構成を有効にする必要があります。Test
if (test) { /* test is valid */ }
if (!test) { /* test is not valid */ }
...そして、次の構成要素を許可しません:
test << 1;
int i = test;
delete test;
if (test1 == test2) {}
if (test != test2) {}