1 namespace std { 2 __f()3void __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: reference_wrapper(type & __f)14 reference_wrapper(type &__f) 15 : __f_(&__f) {} 16 // access 17 operator type &() const { return *__f_; } get()18 type &get() const { return *__f_; } 19 }; 20 21 template <class _Tp> 22 inline reference_wrapper<_Tp> ref(_Tp & __t)23ref(_Tp &__t) noexcept { 24 return reference_wrapper<_Tp>(__t); 25 } 26 27 template <class _Tp> 28 inline reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t)29ref(reference_wrapper<_Tp> __t) noexcept { 30 return ref(__t.get()); 31 } 32 33 } // namespace std 34