08/05/12 10:27:59
>>66
clock()だと間に合わないみたいねw
--
[foo@Corvus tmp]$ ./a.out
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
--
ってことで、こんな風にしてみた。
--
static int staticCounterForDefault;
static int staticCounterForCopy;
struct test
{
int a;
test() : a(++staticCounterForDefault) {}
test(const test & foo) : a(++staticCounterForCopy) {}
};
--
では問題、実行せずに出力結果を予測しなさい。
# って、厳密には実装依存なのかな。