yohhoyの日記

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

2016-06-01から1日間の記事一覧

auto as ラムダ式の戻り値型

C++

C++14以降では、ラムダ式の戻り値型(trailing-return-type)としてautoキーワードを指定できる。*1 // C++11ではNG/C++14以降はOK auto f = [](int a, int b) -> auto { // int型に推論 return a + b; }; auto h = [](auto& v) -> decltype(auto) { return v…