| 1 |
namespace std { |
| 2 |
|
| 3 |
void __f() {} |
| 4 |
|
| 5 |
template <class _Tp> |
| 6 |
class reference_wrapper { |
| 7 |
public: |
| 8 |
typedef _Tp type; |
| 9 |
|
| 10 |
private: |
| 11 |
type *__f_; |
| 12 |
|
| 13 |
public: |
| 14 |
reference_wrapper(type &__f) |
| 15 |
: __f_(&__f) {} |
| 16 |
// access |
| 17 |
operator type &() const { return *__f_; } |
| 18 |
type &get() const { return *__f_; } |
| 19 |
}; |
| 20 |
|
| 21 |
template <class _Tp> |
| 22 |
inline reference_wrapper<_Tp> |
| 23 |
ref(_Tp &__t) noexcept { |
| 24 |
return reference_wrapper<_Tp>(__t); |
| 25 |
} |
| 26 |
|
| 27 |
template <class _Tp> |
| 28 |
inline reference_wrapper<_Tp> |
| 29 |
ref(reference_wrapper<_Tp> __t) noexcept { |
| 30 |
return ref(__t.get()); |
| 31 |
} |
| 32 |
|
| 33 |
} // namespace std |