最終更新日時(UTC):
が更新

履歴 編集

<functional>

std::functional::推論補助(C++17)

namespace std {
  template<class T>
  reference_wrapper(T&) -> reference_wrapper<T>;
}

概要

std::reference_wrapperクラステンプレートの型推論補助。左辺値参照から推論する。

#include <iostream>
#include <functional>

int main()
{
  int x = 3;

  // xへの参照を保持する
  std::reference_wrapper r(x);
  r.get() += 1;
  std::cout << x << std::endl;
}

出力

バージョン

言語

  • C++17

処理系

参照