2011-01-04から1日間の記事一覧

C++0xのautoキーワードによる型推論

C++0xのautoの紹介 autoキーワードを使って変数を定義すると,コンパイラが初期化値を基に変数の型を推論してくれる. int f(); auto x1 = 1; // x1 : int auto x2 = f(); // x2 : int auto x3 = 3.14; // x3 : double auto &x4 = x1; // x4 : int& const au…