yohhoyの日記

技術的メモをしていきたい日記

2012-06-09から1日間の記事一覧

auto&&の落とし穴

C++

C++11で導入されたautoによる型推論とrvalue参照(T&&)に関するメモ。auto&&による型推論の結果が常にrvalue参照型となるとは限らない。 int x; auto t0 = x; // t0はint型 auto& t1 = x; // t1はint&型 auto&& t2 = x; // t2はint&型(int&&型ではない) au…