- functional[meta header]
- std[meta namespace]
- reference_wrapper[meta class]
- function[meta id-type]
- cpp11[meta cpp]
operator T& () const noexcept; //C++11
constexpr operator T& () const noexcept; //C++20
生参照への変換
保持している参照を返す
投げない
#include <iostream>
#include <functional>
int main()
{
int x = 3;
std::reference_wrapper<int> r(x);
int& rx = r; // 参照に暗黙変換する
rx += 1;
std::cout << x << std::endl;
}
4
- C++11
- Clang: ??
- GCC: 4.7.0 [mark verified]
- ICC: ??
- Visual C++: ??