X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libstdc%2B%2B-v3%2Finclude%2Fbackward%2Fbinders.h;h=076f8d2e219cf49bf0c83352dc8685d88309f6f1;hp=313bffcd8242c38c5b67cbe901ec0705cf0edc6d;hb=d97134122bbb1c51b2677b1122621037155cd16d;hpb=5c420bf3e05787056fb07e68d40f55fad6680ff7 diff --git a/libstdc++-v3/include/backward/binders.h b/libstdc++-v3/include/backward/binders.h index 313bffcd824..076f8d2e219 100644 --- a/libstdc++-v3/include/backward/binders.h +++ b/libstdc++-v3/include/backward/binders.h @@ -1,12 +1,12 @@ // Functor implementations -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 // 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, @@ -14,19 +14,14 @@ // 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 +// . /* * @@ -56,46 +51,56 @@ /** @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 s20_3_6_binder Binder Classes - * 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), ... + /** @defgroup binders Binder Classes + * @ingroup functors * - * The function @c bind1st is provided to save some typing. It takes the + * 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 * 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,1.3) will create a + * of the first, e.g., @c bind2nd(std::minus(),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 1.3 - x 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> for declaring a variable to hold the - * return value from @c bind1st(std::plus,5). + * return value from @c bind1st(std::plus(),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 s20_3_6_binder binder functors@endlink. + /// One of the @link binders binder functors@endlink. template class binder1st : public unary_function inline binder1st<_Operation> bind1st(const _Operation& __fn, const _Tp& __x) @@ -130,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return binder1st<_Operation>(__fn, _Arg1_type(__x)); } - /// One of the @link s20_3_6_binder binder functors@endlink. + /// One of the @link binders binder functors@endlink. template class binder2nd : public unary_function inline binder2nd<_Operation> bind2nd(const _Operation& __fn, const _Tp& __x) @@ -166,6 +171,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } /** @} */ -_GLIBCXX_END_NAMESPACE +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace -#endif /* _GLIBCXX_BINDERS_H */ +#endif /* _BACKWARD_BINDERS_H */