Patchwork [v3] improve doxygen comments for binders

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 20, 2011, 9:14 p.m.
Message ID <CAH6eHdSa1UkXaOFzpwEFocmOpxbubr6=DYRSqvduxwMjG8hmKQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/126666/
State New
Headers show

Comments

Jonathan Wakely - Nov. 20, 2011, 9:14 p.m.
* include/backward/binders.h: Fix examples in doxygen comments and
        suggest using std::bind instead.

Tested x86_64-linux, committed to trunk.

Patch

Index: include/backward/binders.h
===================================================================
--- include/backward/binders.h	(revision 181390)
+++ include/backward/binders.h	(working copy)
@@ -80,7 +80,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *
    *  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 <em>1.3 - x</em> instead.
@@ -89,10 +89,15 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  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.