]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/ext/functional
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / ext / functional
index 7d0b45b9b17ac0c92197f4cb95e59b087e80d566..4f50a6003e083f9a57047fe52af63ad4ae98b9dc 100644 (file)
@@ -1,11 +1,11 @@
 // Functional extensions -*- C++ -*-
 
-// Copyright (C) 2002, 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// 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>
 
-namespace __gnu_cxx
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
-  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;
-
-  /** The @c identity_element functions are not part of the C++ standard; SGI
-   *  provided them as an extension.  Its argument is an operation, and its
-   *  return value is the identity element for that operation.  It is overloaded
-   *  for addition and multiplication, and you can overload it for your own
-   *  nefarious operations.
+_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
+   *  operation, and its return value is the identity element for that
+   *  operation.  It is overloaded for addition and multiplication,
+   *  and you can overload it for your own nefarious operations.
    *
    *  @addtogroup SGIextensions
    *  @{
@@ -105,7 +95,7 @@ namespace __gnu_cxx
    *
    *  @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);
@@ -125,8 +115,8 @@ namespace __gnu_cxx
   /// 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;
@@ -150,8 +140,8 @@ namespace __gnu_cxx
   /// 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;
@@ -184,13 +174,14 @@ namespace __gnu_cxx
    *  @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
@@ -198,16 +189,19 @@ namespace __gnu_cxx
    */
   /// 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
@@ -215,7 +209,7 @@ namespace __gnu_cxx
     };
 
   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
@@ -290,7 +284,7 @@ namespace __gnu_cxx
    *  - @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
@@ -348,12 +342,12 @@ namespace __gnu_cxx
    *  @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.
@@ -371,10 +365,10 @@ namespace __gnu_cxx
     {
       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];
@@ -402,24 +396,27 @@ namespace __gnu_cxx
   // 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); }
-} // namespace __gnu_cxx
+    { return std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
 #endif