1*38fd1498Szrj// Functional extensions -*- C++ -*- 2*38fd1498Szrj 3*38fd1498Szrj// Copyright (C) 2002-2018 Free Software Foundation, Inc. 4*38fd1498Szrj// 5*38fd1498Szrj// This file is part of the GNU ISO C++ Library. This library is free 6*38fd1498Szrj// software; you can redistribute it and/or modify it under the 7*38fd1498Szrj// terms of the GNU General Public License as published by the 8*38fd1498Szrj// Free Software Foundation; either version 3, or (at your option) 9*38fd1498Szrj// any later version. 10*38fd1498Szrj 11*38fd1498Szrj// This library is distributed in the hope that it will be useful, 12*38fd1498Szrj// but WITHOUT ANY WARRANTY; without even the implied warranty of 13*38fd1498Szrj// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*38fd1498Szrj// GNU General Public License for more details. 15*38fd1498Szrj 16*38fd1498Szrj// Under Section 7 of GPL version 3, you are granted additional 17*38fd1498Szrj// permissions described in the GCC Runtime Library Exception, version 18*38fd1498Szrj// 3.1, as published by the Free Software Foundation. 19*38fd1498Szrj 20*38fd1498Szrj// You should have received a copy of the GNU General Public License and 21*38fd1498Szrj// a copy of the GCC Runtime Library Exception along with this program; 22*38fd1498Szrj// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23*38fd1498Szrj// <http://www.gnu.org/licenses/>. 24*38fd1498Szrj 25*38fd1498Szrj/* 26*38fd1498Szrj * 27*38fd1498Szrj * Copyright (c) 1994 28*38fd1498Szrj * Hewlett-Packard Company 29*38fd1498Szrj * 30*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software 31*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee, 32*38fd1498Szrj * provided that the above copyright notice appear in all copies and 33*38fd1498Szrj * that both that copyright notice and this permission notice appear 34*38fd1498Szrj * in supporting documentation. Hewlett-Packard Company makes no 35*38fd1498Szrj * representations about the suitability of this software for any 36*38fd1498Szrj * purpose. It is provided "as is" without express or implied warranty. 37*38fd1498Szrj * 38*38fd1498Szrj * 39*38fd1498Szrj * Copyright (c) 1996 40*38fd1498Szrj * Silicon Graphics Computer Systems, Inc. 41*38fd1498Szrj * 42*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software 43*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee, 44*38fd1498Szrj * provided that the above copyright notice appear in all copies and 45*38fd1498Szrj * that both that copyright notice and this permission notice appear 46*38fd1498Szrj * in supporting documentation. Silicon Graphics makes no 47*38fd1498Szrj * representations about the suitability of this software for any 48*38fd1498Szrj * purpose. It is provided "as is" without express or implied warranty. 49*38fd1498Szrj */ 50*38fd1498Szrj 51*38fd1498Szrj/** @file ext/functional 52*38fd1498Szrj * This file is a GNU extension to the Standard C++ Library (possibly 53*38fd1498Szrj * containing extensions from the HP/SGI STL subset). 54*38fd1498Szrj */ 55*38fd1498Szrj 56*38fd1498Szrj#ifndef _EXT_FUNCTIONAL 57*38fd1498Szrj#define _EXT_FUNCTIONAL 1 58*38fd1498Szrj 59*38fd1498Szrj#pragma GCC system_header 60*38fd1498Szrj 61*38fd1498Szrj#include <functional> 62*38fd1498Szrj 63*38fd1498Szrjnamespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 64*38fd1498Szrj{ 65*38fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION 66*38fd1498Szrj 67*38fd1498Szrj using std::size_t; 68*38fd1498Szrj using std::unary_function; 69*38fd1498Szrj using std::binary_function; 70*38fd1498Szrj using std::mem_fun1_t; 71*38fd1498Szrj using std::const_mem_fun1_t; 72*38fd1498Szrj using std::mem_fun1_ref_t; 73*38fd1498Szrj using std::const_mem_fun1_ref_t; 74*38fd1498Szrj 75*38fd1498Szrj /** The @c identity_element functions are not part of the C++ 76*38fd1498Szrj * standard; SGI provided them as an extension. Its argument is an 77*38fd1498Szrj * operation, and its return value is the identity element for that 78*38fd1498Szrj * operation. It is overloaded for addition and multiplication, 79*38fd1498Szrj * and you can overload it for your own nefarious operations. 80*38fd1498Szrj * 81*38fd1498Szrj * @addtogroup SGIextensions 82*38fd1498Szrj * @{ 83*38fd1498Szrj */ 84*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 85*38fd1498Szrj template <class _Tp> 86*38fd1498Szrj inline _Tp 87*38fd1498Szrj identity_element(std::plus<_Tp>) 88*38fd1498Szrj { return _Tp(0); } 89*38fd1498Szrj 90*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 91*38fd1498Szrj template <class _Tp> 92*38fd1498Szrj inline _Tp 93*38fd1498Szrj identity_element(std::multiplies<_Tp>) 94*38fd1498Szrj { return _Tp(1); } 95*38fd1498Szrj /** @} */ 96*38fd1498Szrj 97*38fd1498Szrj /** As an extension to the binders, SGI provided composition functors and 98*38fd1498Szrj * wrapper functions to aid in their creation. The @c unary_compose 99*38fd1498Szrj * functor is constructed from two functions/functors, @c f and @c g. 100*38fd1498Szrj * Calling @c operator() with a single argument @c x returns @c f(g(x)). 101*38fd1498Szrj * The function @c compose1 takes the two functions and constructs a 102*38fd1498Szrj * @c unary_compose variable for you. 103*38fd1498Szrj * 104*38fd1498Szrj * @c binary_compose is constructed from three functors, @c f, @c g1, 105*38fd1498Szrj * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function 106*38fd1498Szrj * compose2 takes f, g1, and g2, and constructs the @c binary_compose 107*38fd1498Szrj * instance for you. For example, if @c f returns an int, then 108*38fd1498Szrj * \code 109*38fd1498Szrj * int answer = (compose2(f,g1,g2))(x); 110*38fd1498Szrj * \endcode 111*38fd1498Szrj * is equivalent to 112*38fd1498Szrj * \code 113*38fd1498Szrj * int temp1 = g1(x); 114*38fd1498Szrj * int temp2 = g2(x); 115*38fd1498Szrj * int answer = f(temp1,temp2); 116*38fd1498Szrj * \endcode 117*38fd1498Szrj * But the first form is more compact, and can be passed around as a 118*38fd1498Szrj * functor to other algorithms. 119*38fd1498Szrj * 120*38fd1498Szrj * @addtogroup SGIextensions 121*38fd1498Szrj * @{ 122*38fd1498Szrj */ 123*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 124*38fd1498Szrj template <class _Operation1, class _Operation2> 125*38fd1498Szrj class unary_compose 126*38fd1498Szrj : public unary_function<typename _Operation2::argument_type, 127*38fd1498Szrj typename _Operation1::result_type> 128*38fd1498Szrj { 129*38fd1498Szrj protected: 130*38fd1498Szrj _Operation1 _M_fn1; 131*38fd1498Szrj _Operation2 _M_fn2; 132*38fd1498Szrj 133*38fd1498Szrj public: 134*38fd1498Szrj unary_compose(const _Operation1& __x, const _Operation2& __y) 135*38fd1498Szrj : _M_fn1(__x), _M_fn2(__y) {} 136*38fd1498Szrj 137*38fd1498Szrj typename _Operation1::result_type 138*38fd1498Szrj operator()(const typename _Operation2::argument_type& __x) const 139*38fd1498Szrj { return _M_fn1(_M_fn2(__x)); } 140*38fd1498Szrj }; 141*38fd1498Szrj 142*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 143*38fd1498Szrj template <class _Operation1, class _Operation2> 144*38fd1498Szrj inline unary_compose<_Operation1, _Operation2> 145*38fd1498Szrj compose1(const _Operation1& __fn1, const _Operation2& __fn2) 146*38fd1498Szrj { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); } 147*38fd1498Szrj 148*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 149*38fd1498Szrj template <class _Operation1, class _Operation2, class _Operation3> 150*38fd1498Szrj class binary_compose 151*38fd1498Szrj : public unary_function<typename _Operation2::argument_type, 152*38fd1498Szrj typename _Operation1::result_type> 153*38fd1498Szrj { 154*38fd1498Szrj protected: 155*38fd1498Szrj _Operation1 _M_fn1; 156*38fd1498Szrj _Operation2 _M_fn2; 157*38fd1498Szrj _Operation3 _M_fn3; 158*38fd1498Szrj 159*38fd1498Szrj public: 160*38fd1498Szrj binary_compose(const _Operation1& __x, const _Operation2& __y, 161*38fd1498Szrj const _Operation3& __z) 162*38fd1498Szrj : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } 163*38fd1498Szrj 164*38fd1498Szrj typename _Operation1::result_type 165*38fd1498Szrj operator()(const typename _Operation2::argument_type& __x) const 166*38fd1498Szrj { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); } 167*38fd1498Szrj }; 168*38fd1498Szrj 169*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 170*38fd1498Szrj template <class _Operation1, class _Operation2, class _Operation3> 171*38fd1498Szrj inline binary_compose<_Operation1, _Operation2, _Operation3> 172*38fd1498Szrj compose2(const _Operation1& __fn1, const _Operation2& __fn2, 173*38fd1498Szrj const _Operation3& __fn3) 174*38fd1498Szrj { return binary_compose<_Operation1, _Operation2, _Operation3> 175*38fd1498Szrj (__fn1, __fn2, __fn3); } 176*38fd1498Szrj /** @} */ 177*38fd1498Szrj 178*38fd1498Szrj /** As an extension, SGI provided a functor called @c identity. When a 179*38fd1498Szrj * functor is required but no operations are desired, this can be used as a 180*38fd1498Szrj * pass-through. Its @c operator() returns its argument unchanged. 181*38fd1498Szrj * 182*38fd1498Szrj * @addtogroup SGIextensions 183*38fd1498Szrj */ 184*38fd1498Szrj template <class _Tp> 185*38fd1498Szrj struct identity 186*38fd1498Szrj : public std::_Identity<_Tp> {}; 187*38fd1498Szrj 188*38fd1498Szrj /** @c select1st and @c select2nd are extensions provided by SGI. Their 189*38fd1498Szrj * @c operator()s 190*38fd1498Szrj * take a @c std::pair as an argument, and return either the first member 191*38fd1498Szrj * or the second member, respectively. They can be used (especially with 192*38fd1498Szrj * the composition functors) to @a strip data from a sequence before 193*38fd1498Szrj * performing the remainder of an algorithm. 194*38fd1498Szrj * 195*38fd1498Szrj * @addtogroup SGIextensions 196*38fd1498Szrj * @{ 197*38fd1498Szrj */ 198*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 199*38fd1498Szrj template <class _Pair> 200*38fd1498Szrj struct select1st 201*38fd1498Szrj : public std::_Select1st<_Pair> {}; 202*38fd1498Szrj 203*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 204*38fd1498Szrj template <class _Pair> 205*38fd1498Szrj struct select2nd 206*38fd1498Szrj : public std::_Select2nd<_Pair> {}; 207*38fd1498Szrj 208*38fd1498Szrj /** @} */ 209*38fd1498Szrj 210*38fd1498Szrj // extension documented next 211*38fd1498Szrj template <class _Arg1, class _Arg2> 212*38fd1498Szrj struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> 213*38fd1498Szrj { 214*38fd1498Szrj _Arg1 215*38fd1498Szrj operator()(const _Arg1& __x, const _Arg2&) const 216*38fd1498Szrj { return __x; } 217*38fd1498Szrj }; 218*38fd1498Szrj 219*38fd1498Szrj template <class _Arg1, class _Arg2> 220*38fd1498Szrj struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> 221*38fd1498Szrj { 222*38fd1498Szrj _Arg2 223*38fd1498Szrj operator()(const _Arg1&, const _Arg2& __y) const 224*38fd1498Szrj { return __y; } 225*38fd1498Szrj }; 226*38fd1498Szrj 227*38fd1498Szrj /** The @c operator() of the @c project1st functor takes two arbitrary 228*38fd1498Szrj * arguments and returns the first one, while @c project2nd returns the 229*38fd1498Szrj * second one. They are extensions provided by SGI. 230*38fd1498Szrj * 231*38fd1498Szrj * @addtogroup SGIextensions 232*38fd1498Szrj * @{ 233*38fd1498Szrj */ 234*38fd1498Szrj 235*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 236*38fd1498Szrj template <class _Arg1, class _Arg2> 237*38fd1498Szrj struct project1st : public _Project1st<_Arg1, _Arg2> {}; 238*38fd1498Szrj 239*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 240*38fd1498Szrj template <class _Arg1, class _Arg2> 241*38fd1498Szrj struct project2nd : public _Project2nd<_Arg1, _Arg2> {}; 242*38fd1498Szrj /** @} */ 243*38fd1498Szrj 244*38fd1498Szrj // extension documented next 245*38fd1498Szrj template <class _Result> 246*38fd1498Szrj struct _Constant_void_fun 247*38fd1498Szrj { 248*38fd1498Szrj typedef _Result result_type; 249*38fd1498Szrj result_type _M_val; 250*38fd1498Szrj 251*38fd1498Szrj _Constant_void_fun(const result_type& __v) : _M_val(__v) {} 252*38fd1498Szrj 253*38fd1498Szrj const result_type& 254*38fd1498Szrj operator()() const 255*38fd1498Szrj { return _M_val; } 256*38fd1498Szrj }; 257*38fd1498Szrj 258*38fd1498Szrj template <class _Result, class _Argument> 259*38fd1498Szrj struct _Constant_unary_fun 260*38fd1498Szrj { 261*38fd1498Szrj typedef _Argument argument_type; 262*38fd1498Szrj typedef _Result result_type; 263*38fd1498Szrj result_type _M_val; 264*38fd1498Szrj 265*38fd1498Szrj _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} 266*38fd1498Szrj 267*38fd1498Szrj const result_type& 268*38fd1498Szrj operator()(const _Argument&) const 269*38fd1498Szrj { return _M_val; } 270*38fd1498Szrj }; 271*38fd1498Szrj 272*38fd1498Szrj template <class _Result, class _Arg1, class _Arg2> 273*38fd1498Szrj struct _Constant_binary_fun 274*38fd1498Szrj { 275*38fd1498Szrj typedef _Arg1 first_argument_type; 276*38fd1498Szrj typedef _Arg2 second_argument_type; 277*38fd1498Szrj typedef _Result result_type; 278*38fd1498Szrj _Result _M_val; 279*38fd1498Szrj 280*38fd1498Szrj _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} 281*38fd1498Szrj 282*38fd1498Szrj const result_type& 283*38fd1498Szrj operator()(const _Arg1&, const _Arg2&) const 284*38fd1498Szrj { return _M_val; } 285*38fd1498Szrj }; 286*38fd1498Szrj 287*38fd1498Szrj /** These three functors are each constructed from a single arbitrary 288*38fd1498Szrj * variable/value. Later, their @c operator()s completely ignore any 289*38fd1498Szrj * arguments passed, and return the stored value. 290*38fd1498Szrj * - @c constant_void_fun's @c operator() takes no arguments 291*38fd1498Szrj * - @c constant_unary_fun's @c operator() takes one argument (ignored) 292*38fd1498Szrj * - @c constant_binary_fun's @c operator() takes two arguments (ignored) 293*38fd1498Szrj * 294*38fd1498Szrj * The helper creator functions @c constant0, @c constant1, and 295*38fd1498Szrj * @c constant2 each take a @a result argument and construct variables of 296*38fd1498Szrj * the appropriate functor type. 297*38fd1498Szrj * 298*38fd1498Szrj * @addtogroup SGIextensions 299*38fd1498Szrj * @{ 300*38fd1498Szrj */ 301*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 302*38fd1498Szrj template <class _Result> 303*38fd1498Szrj struct constant_void_fun 304*38fd1498Szrj : public _Constant_void_fun<_Result> 305*38fd1498Szrj { 306*38fd1498Szrj constant_void_fun(const _Result& __v) 307*38fd1498Szrj : _Constant_void_fun<_Result>(__v) {} 308*38fd1498Szrj }; 309*38fd1498Szrj 310*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 311*38fd1498Szrj template <class _Result, class _Argument = _Result> 312*38fd1498Szrj struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument> 313*38fd1498Szrj { 314*38fd1498Szrj constant_unary_fun(const _Result& __v) 315*38fd1498Szrj : _Constant_unary_fun<_Result, _Argument>(__v) {} 316*38fd1498Szrj }; 317*38fd1498Szrj 318*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 319*38fd1498Szrj template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1> 320*38fd1498Szrj struct constant_binary_fun 321*38fd1498Szrj : public _Constant_binary_fun<_Result, _Arg1, _Arg2> 322*38fd1498Szrj { 323*38fd1498Szrj constant_binary_fun(const _Result& __v) 324*38fd1498Szrj : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} 325*38fd1498Szrj }; 326*38fd1498Szrj 327*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 328*38fd1498Szrj template <class _Result> 329*38fd1498Szrj inline constant_void_fun<_Result> 330*38fd1498Szrj constant0(const _Result& __val) 331*38fd1498Szrj { return constant_void_fun<_Result>(__val); } 332*38fd1498Szrj 333*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 334*38fd1498Szrj template <class _Result> 335*38fd1498Szrj inline constant_unary_fun<_Result, _Result> 336*38fd1498Szrj constant1(const _Result& __val) 337*38fd1498Szrj { return constant_unary_fun<_Result, _Result>(__val); } 338*38fd1498Szrj 339*38fd1498Szrj /// An \link SGIextensions SGI extension \endlink. 340*38fd1498Szrj template <class _Result> 341*38fd1498Szrj inline constant_binary_fun<_Result,_Result,_Result> 342*38fd1498Szrj constant2(const _Result& __val) 343*38fd1498Szrj { return constant_binary_fun<_Result, _Result, _Result>(__val); } 344*38fd1498Szrj /** @} */ 345*38fd1498Szrj 346*38fd1498Szrj /** The @c subtractive_rng class is documented on 347*38fd1498Szrj * <a href="http://www.sgi.com/tech/stl/">SGI's site</a>. 348*38fd1498Szrj * Note that this code assumes that @c int is 32 bits. 349*38fd1498Szrj * 350*38fd1498Szrj * @ingroup SGIextensions 351*38fd1498Szrj */ 352*38fd1498Szrj class subtractive_rng 353*38fd1498Szrj : public unary_function<unsigned int, unsigned int> 354*38fd1498Szrj { 355*38fd1498Szrj private: 356*38fd1498Szrj unsigned int _M_table[55]; 357*38fd1498Szrj size_t _M_index1; 358*38fd1498Szrj size_t _M_index2; 359*38fd1498Szrj 360*38fd1498Szrj public: 361*38fd1498Szrj /// Returns a number less than the argument. 362*38fd1498Szrj unsigned int 363*38fd1498Szrj operator()(unsigned int __limit) 364*38fd1498Szrj { 365*38fd1498Szrj _M_index1 = (_M_index1 + 1) % 55; 366*38fd1498Szrj _M_index2 = (_M_index2 + 1) % 55; 367*38fd1498Szrj _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; 368*38fd1498Szrj return _M_table[_M_index1] % __limit; 369*38fd1498Szrj } 370*38fd1498Szrj 371*38fd1498Szrj void 372*38fd1498Szrj _M_initialize(unsigned int __seed) 373*38fd1498Szrj { 374*38fd1498Szrj unsigned int __k = 1; 375*38fd1498Szrj _M_table[54] = __seed; 376*38fd1498Szrj size_t __i; 377*38fd1498Szrj for (__i = 0; __i < 54; __i++) 378*38fd1498Szrj { 379*38fd1498Szrj size_t __ii = (21 * (__i + 1) % 55) - 1; 380*38fd1498Szrj _M_table[__ii] = __k; 381*38fd1498Szrj __k = __seed - __k; 382*38fd1498Szrj __seed = _M_table[__ii]; 383*38fd1498Szrj } 384*38fd1498Szrj for (int __loop = 0; __loop < 4; __loop++) 385*38fd1498Szrj { 386*38fd1498Szrj for (__i = 0; __i < 55; __i++) 387*38fd1498Szrj _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; 388*38fd1498Szrj } 389*38fd1498Szrj _M_index1 = 0; 390*38fd1498Szrj _M_index2 = 31; 391*38fd1498Szrj } 392*38fd1498Szrj 393*38fd1498Szrj /// Ctor allowing you to initialize the seed. 394*38fd1498Szrj subtractive_rng(unsigned int __seed) 395*38fd1498Szrj { _M_initialize(__seed); } 396*38fd1498Szrj 397*38fd1498Szrj /// Default ctor; initializes its state with some number you don't see. 398*38fd1498Szrj subtractive_rng() 399*38fd1498Szrj { _M_initialize(161803398u); } 400*38fd1498Szrj }; 401*38fd1498Szrj 402*38fd1498Szrj // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref, 403*38fd1498Szrj // provided for backward compatibility, they are no longer part of 404*38fd1498Szrj // the C++ standard. 405*38fd1498Szrj 406*38fd1498Szrj template <class _Ret, class _Tp, class _Arg> 407*38fd1498Szrj inline mem_fun1_t<_Ret, _Tp, _Arg> 408*38fd1498Szrj mem_fun1(_Ret (_Tp::*__f)(_Arg)) 409*38fd1498Szrj { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } 410*38fd1498Szrj 411*38fd1498Szrj template <class _Ret, class _Tp, class _Arg> 412*38fd1498Szrj inline const_mem_fun1_t<_Ret, _Tp, _Arg> 413*38fd1498Szrj mem_fun1(_Ret (_Tp::*__f)(_Arg) const) 414*38fd1498Szrj { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } 415*38fd1498Szrj 416*38fd1498Szrj template <class _Ret, class _Tp, class _Arg> 417*38fd1498Szrj inline mem_fun1_ref_t<_Ret, _Tp, _Arg> 418*38fd1498Szrj mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)) 419*38fd1498Szrj { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } 420*38fd1498Szrj 421*38fd1498Szrj template <class _Ret, class _Tp, class _Arg> 422*38fd1498Szrj inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> 423*38fd1498Szrj mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) 424*38fd1498Szrj { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } 425*38fd1498Szrj 426*38fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION 427*38fd1498Szrj} // namespace 428*38fd1498Szrj 429*38fd1498Szrj#endif 430*38fd1498Szrj 431