yohhoyの日記

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

2020-11-09から1日間の記事一覧

std::functionのテンプレート推論ガイド

C++

C++17標準ライブラリで導入されたstd::functionクラステンプレートの推論ガイド(deduction guide)についてメモ。 #include <functional> // 関数ポインタから推論 int f(int n) { return n; } std::function f1 = f; // OK: function<int(int)> // ラムダ式から推論 std::function </int(int)></functional>…