2013-03-29から1日間の記事一覧

std::map.operator[] に std::map.size() を代入した時の挙動が怖い

C++

助けてください > 闇の軍団の方々 問題のコード #include <iostream> #include <map> int main() { std::map<int, int> dict; dict[123] = dict.size(); std::cout << "result: " << dict[123] << std::endl; } 実行結果 /Users/arosh/clang clang++ -v Apple LLVM version 4.2 (clang</int,></map></iostream>…