1 // TR1 functional header -*- C++ -*-
3 // Copyright (C) 2004 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 * This is a TR1 C++ Library header.
25 #ifndef _TR1_FUNCTIONAL
26 #define _TR1_FUNCTIONAL 1
28 #include "../functional"
34 template<typename _Tp>
35 class reference_wrapper
40 explicit reference_wrapper(_Tp& __indata): _M_data(&__indata)
43 reference_wrapper(const reference_wrapper<_Tp>& __inref):
44 _M_data(__inref._M_data)
48 operator=(const reference_wrapper<_Tp>& __inref)
50 _M_data = __inref._M_data;
55 { return this->get(); }
62 // Denotes a reference should be taken to a variable.
63 template<typename _Tp>
64 reference_wrapper<_Tp>
66 { return reference_wrapper<_Tp>(__t); }
68 // Denotes a const reference should be taken to a variable.
69 template<typename _Tp>
70 reference_wrapper<const _Tp>
72 { return reference_wrapper<const _Tp>(__t); }
74 template<typename _Tp>
75 reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t)
76 { return ref(__t.get()); }
78 template<typename _Tp>
79 reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t)
80 { return cref(__t.get()); }