OSDN Git Service

* include/backward/binders.h: Fix examples in doxygen comments and
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / backward / binders.h
index 9b059ce..076f8d2 100644 (file)
@@ -1,6 +1,6 @@
 // Functor implementations -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 
 /** @file backward/binders.h
  *  This is an internal header file, included by other library headers.
- *  You should not attempt to use it directly.
+ *  Do not attempt to use it directly. @headername{functional}
  */
 
-#ifndef _GLIBCXX_BINDERS_H
-#define _GLIBCXX_BINDERS_H 1
+#ifndef _BACKWARD_BINDERS_H
+#define _BACKWARD_BINDERS_H 1
 
-_GLIBCXX_BEGIN_NAMESPACE(std)
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // 20.3.6 binders
   /** @defgroup binders Binder Classes
    * @ingroup functors
    *
-   *  Binders turn functions/functors with two arguments into functors with
-   *  a single argument, storing an argument to be applied later.  For
-   *  example, a variable @c B of type @c binder1st is constructed from a
-   *  functor @c f and an argument @c x.  Later, B's @c operator() is called
-   *  with a single argument @c y.  The return value is the value of @c f(x,y).
-   *  @c B can be "called" with various arguments (y1, y2, ...) and will in
-   *  turn call @c f(x,y1), @c f(x,y2), ...
+   *  Binders turn functions/functors with two arguments into functors
+   *  with a single argument, storing an argument to be applied later.
+   *  For example, a variable @c B of type @c binder1st is constructed
+   *  from a functor @c f and an argument @c x. Later, B's @c
+   *  operator() is called with a single argument @c y. The return
+   *  value is the value of @c f(x,y). @c B can be @a called with
+   *  various arguments (y1, y2, ...) and will in turn call @c
+   *  f(x,y1), @c f(x,y2), ...
    *
-   *  The function @c bind1st is provided to save some typing.  It takes the
+   *  The function @c bind1st is provided to save some typing. It takes the
    *  function and an argument as parameters, and returns an instance of
    *  @c binder1st.
    *
    *  The type @c binder2nd and its creator function @c bind2nd do the same
    *  thing, but the stored argument is passed as the second parameter instead
-   *  of the first, e.g., @c bind2nd(std::minus<float>,1.3) will create a
+   *  of the first, e.g., @c bind2nd(std::minus<float>(),1.3) will create a
    *  functor whose @c operator() accepts a floating-point number, subtracts
-   *  1.3 from it, and returns the result.  (If @c bind1st had been used,
-   *  the functor would perform "1.3 - x" instead.
+   *  1.3 from it, and returns the result. (If @c bind1st had been used,
+   *  the functor would perform <em>1.3 - x</em> instead.
    *
    *  Creator-wrapper functions like @c bind1st are intended to be used in
-   *  calling algorithms.  Their return values will be temporary objects.
+   *  calling algorithms. Their return values will be temporary objects.
    *  (The goal is to not require you to type names like
    *  @c std::binder1st<std::plus<int>> for declaring a variable to hold the
-   *  return value from @c bind1st(std::plus<int>,5).
+   *  return value from @c bind1st(std::plus<int>(),5).
    *
    *  These become more useful when combined with the composition functions.
    *
+   *  These functions are deprecated in C++11 and can be replaced by
+   *  @c std::bind (or @c std::tr1::bind) which is more powerful and flexible,
+   *  supporting functions with any number of arguments.  Uses of @c bind1st
+   *  can be replaced by @c std::bind(f, x, std::placeholders::_1) and
+   *  @c bind2nd by @c std::bind(f, std::placeholders::_1, x).
    *  @{
    */
   /// One of the @link binders binder functors@endlink.
@@ -116,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typename _Operation::result_type
       operator()(typename _Operation::second_argument_type& __x) const
       { return op(value, __x); }
-    } _GLIBCXX_DEPRECATED_ATTR;
+    } _GLIBCXX_DEPRECATED;
 
   /// One of the @link binders binder functors@endlink.
   template<typename _Operation, typename _Tp>
@@ -151,7 +159,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typename _Operation::result_type
       operator()(typename _Operation::first_argument_type& __x) const
       { return op(__x, value); }
-    } _GLIBCXX_DEPRECATED_ATTR;
+    } _GLIBCXX_DEPRECATED;
 
   /// One of the @link binders binder functors@endlink.
   template<typename _Operation, typename _Tp>
@@ -163,6 +171,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     } 
   /** @}  */
 
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
 
-#endif /* _GLIBCXX_BINDERS_H */
+#endif /* _BACKWARD_BINDERS_H */