// Functional extensions -*- C++ -*-
-// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2002-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
+// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
/*
*
#include <functional>
-_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
-
- using std::unary_function;
- using std::binary_function;
- using std::mem_fun1_t;
- using std::const_mem_fun1_t;
- using std::mem_fun1_ref_t;
- using std::const_mem_fun1_ref_t;
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
/** The @c identity_element functions are not part of the C++
* standard; SGI provided them as an extension. Its argument is an
*
* @c binary_compose is constructed from three functors, @c f, @c g1,
* and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
- * @compose2 takes f, g1, and g2, and constructs the @c binary_compose
+ * compose2 takes f, g1, and g2, and constructs the @c binary_compose
* instance for you. For example, if @c f returns an int, then
* \code
* int answer = (compose2(f,g1,g2))(x);
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2>
class unary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
+ : public std::unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2, class _Operation3>
class binary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
+ : public std::unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
* @addtogroup SGIextensions
*/
template <class _Tp>
- struct identity : public std::_Identity<_Tp> {};
+ struct identity
+ : public std::_Identity<_Tp> {};
/** @c select1st and @c select2nd are extensions provided by SGI. Their
* @c operator()s
* take a @c std::pair as an argument, and return either the first member
* or the second member, respectively. They can be used (especially with
- * the composition functors) to "strip" data from a sequence before
+ * the composition functors) to @a strip data from a sequence before
* performing the remainder of an algorithm.
*
* @addtogroup SGIextensions
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Pair>
- struct select1st : public std::_Select1st<_Pair> {};
+ struct select1st
+ : public std::_Select1st<_Pair> {};
/// An \link SGIextensions SGI extension \endlink.
template <class _Pair>
- struct select2nd : public std::_Select2nd<_Pair> {};
+ struct select2nd
+ : public std::_Select2nd<_Pair> {};
+
/** @} */
// extension documented next
template <class _Arg1, class _Arg2>
- struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>
+ struct _Project1st : public std::binary_function<_Arg1, _Arg2, _Arg1>
{
_Arg1
operator()(const _Arg1& __x, const _Arg2&) const
};
template <class _Arg1, class _Arg2>
- struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>
+ struct _Project2nd : public std::binary_function<_Arg1, _Arg2, _Arg2>
{
_Arg2
operator()(const _Arg1&, const _Arg2& __y) const
* - @c constant_binary_fun's @c operator() takes two arguments (ignored)
*
* The helper creator functions @c constant0, @c constant1, and
- * @c constant2 each take a "result" argument and construct variables of
+ * @c constant2 each take a @a result argument and construct variables of
* the appropriate functor type.
*
* @addtogroup SGIextensions
* @ingroup SGIextensions
*/
class subtractive_rng
- : public unary_function<unsigned int, unsigned int>
+ : public std::unary_function<unsigned int, unsigned int>
{
private:
unsigned int _M_table[55];
- size_t _M_index1;
- size_t _M_index2;
+ std::size_t _M_index1;
+ std::size_t _M_index2;
public:
/// Returns a number less than the argument.
{
unsigned int __k = 1;
_M_table[54] = __seed;
- size_t __i;
+ std::size_t __i;
for (__i = 0; __i < 54; __i++)
{
- size_t __ii = (21 * (__i + 1) % 55) - 1;
+ std::size_t __ii = (21 * (__i + 1) % 55) - 1;
_M_table[__ii] = __k;
__k = __seed - __k;
__seed = _M_table[__ii];
// the C++ standard.
template <class _Ret, class _Tp, class _Arg>
- inline mem_fun1_t<_Ret, _Tp, _Arg>
+ inline std::mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+ inline std::const_mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ inline std::mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ inline std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
#endif