c++config (_GLIBCXX_DEPRECATED, [...]): New.
2007-10-29 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config (_GLIBCXX_DEPRECATED, _GLIBCXX_USE_DEPRECATED): New. Adjust comments. * include/bits/stl_auto_ptr.h: Move... * includse/backward/auto_ptr.h: ...here. * include/bits/stl_function.h (binder1st, binder2nd, bind1st, bind2nd): Move... * include/backward/binders.h: ...here. Deprecate in C++0x. * include/tr1_impl/boost_shared_ptr.h: Guard auto_ptr usage. * include/std/memory: Same. * include/std/streambuf: Consistent use of _GLIBCXX_USE_DEPRECATED. * include/backward/strstream: Fix guard macros. * include/backward/backward_warning.h: Adjust for all new items. * config/abi/pre/gnu.ver: Export basic_streambuf::stossc. * include/Makefile.am (backward_headers): Adjust. * include/Makefile.in: Regenerate. * configure: Regenerate. From-SVN: r129733
This commit is contained in:
parent
0ba227b5a4
commit
40abbf1f17
13 changed files with 283 additions and 138 deletions
|
@ -1,3 +1,26 @@
|
|||
2007-10-29 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/c++config (_GLIBCXX_DEPRECATED,
|
||||
_GLIBCXX_USE_DEPRECATED): New. Adjust comments.
|
||||
* include/bits/stl_auto_ptr.h: Move...
|
||||
* includse/backward/auto_ptr.h: ...here.
|
||||
* include/bits/stl_function.h (binder1st, binder2nd, bind1st,
|
||||
bind2nd): Move...
|
||||
* include/backward/binders.h: ...here. Deprecate in C++0x.
|
||||
|
||||
* include/tr1_impl/boost_shared_ptr.h: Guard auto_ptr usage.
|
||||
* include/std/memory: Same.
|
||||
* include/std/streambuf: Consistent use of _GLIBCXX_USE_DEPRECATED.
|
||||
|
||||
* include/backward/strstream: Fix guard macros.
|
||||
* include/backward/backward_warning.h: Adjust for all new items.
|
||||
|
||||
* config/abi/pre/gnu.ver: Export basic_streambuf::stossc.
|
||||
|
||||
* include/Makefile.am (backward_headers): Adjust.
|
||||
* include/Makefile.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
|
||||
2007-10-29 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/Makefile.am (ext_compat_headers): New.
|
||||
|
|
|
@ -48,7 +48,7 @@ GLIBCXX_3.4 {
|
|||
std::basic_ostr[a-d]*;
|
||||
std::basic_ostr[f-z]*;
|
||||
std::basic_[p-r]*;
|
||||
std::basic_streambuf*;
|
||||
# std::basic_streambuf
|
||||
# std::basic_string
|
||||
# std::basic_stringbuf
|
||||
std::basic_stringstream*;
|
||||
|
@ -233,6 +233,13 @@ GLIBCXX_3.4 {
|
|||
_ZNKSbIwSt11char_traitsIwESaIwEE9_M_ibeginEv;
|
||||
_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_E*;
|
||||
|
||||
# std::basic_streambuf
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[CD]*;
|
||||
_ZNKSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9]*;
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][a-z][^t]*;
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][0-9][a-z][^t]*;
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EEaSERKS2_;
|
||||
|
||||
# std::basic_stringbuf
|
||||
_ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[CD]*;
|
||||
_ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][a-r]*;
|
||||
|
@ -777,6 +784,8 @@ GLIBCXX_3.4.10 {
|
|||
_ZNSt9__cxx199815_List_node_base7reverseEv;
|
||||
_ZNSt9__cxx199815_List_node_base8transfer*;
|
||||
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv;
|
||||
|
||||
} GLIBCXX_3.4.9;
|
||||
|
||||
# Symbols in the support library (libsupc++) have their own tag.
|
||||
|
|
|
@ -119,7 +119,6 @@ bits_headers = \
|
|||
${bits_srcdir}/stl_iterator_base_types.h \
|
||||
${bits_srcdir}/stl_list.h \
|
||||
${bits_srcdir}/stl_map.h \
|
||||
${bits_srcdir}/stl_auto_ptr.h \
|
||||
${bits_srcdir}/stl_move.h \
|
||||
${bits_srcdir}/stl_multimap.h \
|
||||
${bits_srcdir}/stl_multiset.h \
|
||||
|
@ -145,12 +144,14 @@ bits_headers = \
|
|||
backward_srcdir = ${glibcxx_srcdir}/include/backward
|
||||
backward_builddir = ./backward
|
||||
backward_headers = \
|
||||
${backward_srcdir}/strstream \
|
||||
${backward_srcdir}/auto_ptr.h \
|
||||
${backward_srcdir}/backward_warning.h \
|
||||
${backward_srcdir}/binders.h \
|
||||
${backward_srcdir}/hash_map \
|
||||
${backward_srcdir}/hash_set \
|
||||
${backward_srcdir}/hash_fun.h \
|
||||
${backward_srcdir}/hashtable.h \
|
||||
${backward_srcdir}/backward_warning.h
|
||||
${backward_srcdir}/strstream
|
||||
|
||||
pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
|
||||
pb_builddir = ./ext/pb_ds
|
||||
|
|
|
@ -368,7 +368,6 @@ bits_headers = \
|
|||
${bits_srcdir}/stl_iterator_base_types.h \
|
||||
${bits_srcdir}/stl_list.h \
|
||||
${bits_srcdir}/stl_map.h \
|
||||
${bits_srcdir}/stl_auto_ptr.h \
|
||||
${bits_srcdir}/stl_move.h \
|
||||
${bits_srcdir}/stl_multimap.h \
|
||||
${bits_srcdir}/stl_multiset.h \
|
||||
|
@ -394,12 +393,14 @@ bits_headers = \
|
|||
backward_srcdir = ${glibcxx_srcdir}/include/backward
|
||||
backward_builddir = ./backward
|
||||
backward_headers = \
|
||||
${backward_srcdir}/strstream \
|
||||
${backward_srcdir}/auto_ptr.h \
|
||||
${backward_srcdir}/backward_warning.h \
|
||||
${backward_srcdir}/binders.h \
|
||||
${backward_srcdir}/hash_map \
|
||||
${backward_srcdir}/hash_set \
|
||||
${backward_srcdir}/hash_fun.h \
|
||||
${backward_srcdir}/hashtable.h \
|
||||
${backward_srcdir}/backward_warning.h
|
||||
${backward_srcdir}/strstream
|
||||
|
||||
pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
|
||||
pb_builddir = ./ext/pb_ds
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/** @file stl_auto_ptr.h
|
||||
/** @file backward/auto_ptr.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
|
||||
explicit
|
||||
auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
|
||||
};
|
||||
} _GLIBCXX_DEPRECATED;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -285,7 +285,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
template<typename _Tp1>
|
||||
operator auto_ptr<_Tp1>() throw()
|
||||
{ return auto_ptr<_Tp1>(this->release()); }
|
||||
};
|
||||
} _GLIBCXX_DEPRECATED;
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 541. shared_ptr template assignment and void
|
||||
|
@ -294,7 +294,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
{
|
||||
public:
|
||||
typedef void element_type;
|
||||
};
|
||||
} _GLIBCXX_DEPRECATED;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE
|
||||
|
|
@ -30,15 +30,24 @@
|
|||
|
||||
#ifdef __DEPRECATED
|
||||
#warning This file includes at least one deprecated or antiquated header. \
|
||||
Please consider the use of alternate interfaces as follows: \
|
||||
<sstream> basic_stringbuf <strstream> strstreambuf \
|
||||
<sstream> basic_istringstream <strstream> istrstream \
|
||||
<sstream> basic_ostringstream <strstream> ostrstream \
|
||||
<sstream> basic_stringstream <strstream> strstream \
|
||||
<unordered_set> unordered_set <ext/hash_set> hash_set \
|
||||
<unordered_set> unordered_multiset <ext/hash_set> hash_multiset \
|
||||
<unordered_map> unordered_map <ext/hash_set> hash_map \
|
||||
<unordered_map> unordered_multimap <ext/hash_set> hash_multimap \
|
||||
Please consider use of an equivalent, non-deprecated interface for the \
|
||||
requested functionality. A list of valid replacements is as follows: \
|
||||
\
|
||||
Use: Instead of: \
|
||||
<sstream>, basic_stringbuf <strstream>, strstreambuf \
|
||||
<sstream>, basic_istringstream <strstream>, istrstream \
|
||||
<sstream>, basic_ostringstream <strstream>, ostrstream \
|
||||
<sstream>, basic_stringstream <strstream>, strstream \
|
||||
<unordered_set>, unordered_set <ext/hash_set>, hash_set \
|
||||
<unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset \
|
||||
<unordered_map>, unordered_map <ext/hash_set>, hash_map \
|
||||
<unordered_map>, unordered_multimap <ext/hash_set>, hash_multimap \
|
||||
<functional>, bind <functional>, binder1st \
|
||||
<functional>, bind <functional>, binder2nd \
|
||||
<functional>, bind <functional>, bind1st \
|
||||
<functional>, bind <functional>, bind2nd \
|
||||
<memory>, unique_ptr <memory>, auto_ptr \
|
||||
\
|
||||
To disable this warning use -Wno-deprecated.
|
||||
#endif
|
||||
|
||||
|
|
171
libstdc++-v3/include/backward/binders.h
Normal file
171
libstdc++-v3/include/backward/binders.h
Normal file
|
@ -0,0 +1,171 @@
|
|||
// Functor implementations -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
// 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)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996-1998
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file backward/binders.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_BINDERS_H
|
||||
#define _GLIBCXX_BINDERS_H 1
|
||||
|
||||
_GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
// 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), ...
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Creator-wrapper functions like @c bind1st are intended to be used in
|
||||
* 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).
|
||||
*
|
||||
* These become more useful when combined with the composition functions.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation>
|
||||
class binder1st
|
||||
: public unary_function<typename _Operation::second_argument_type,
|
||||
typename _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
typename _Operation::first_argument_type value;
|
||||
|
||||
public:
|
||||
binder1st(const _Operation& __x,
|
||||
const typename _Operation::first_argument_type& __y)
|
||||
: op(__x), value(__y) { }
|
||||
|
||||
typename _Operation::result_type
|
||||
operator()(const typename _Operation::second_argument_type& __x) const
|
||||
{ return op(value, __x); }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 109. Missing binders for non-const sequence elements
|
||||
typename _Operation::result_type
|
||||
operator()(typename _Operation::second_argument_type& __x) const
|
||||
{ return op(value, __x); }
|
||||
} _GLIBCXX_DEPRECATED;
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation, typename _Tp>
|
||||
inline binder1st<_Operation>
|
||||
bind1st(const _Operation& __fn, const _Tp& __x)
|
||||
{
|
||||
typedef typename _Operation::first_argument_type _Arg1_type;
|
||||
return binder1st<_Operation>(__fn, _Arg1_type(__x));
|
||||
}
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation>
|
||||
class binder2nd
|
||||
: public unary_function<typename _Operation::first_argument_type,
|
||||
typename _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
typename _Operation::second_argument_type value;
|
||||
|
||||
public:
|
||||
binder2nd(const _Operation& __x,
|
||||
const typename _Operation::second_argument_type& __y)
|
||||
: op(__x), value(__y) { }
|
||||
|
||||
typename _Operation::result_type
|
||||
operator()(const typename _Operation::first_argument_type& __x) const
|
||||
{ return op(__x, value); }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 109. Missing binders for non-const sequence elements
|
||||
typename _Operation::result_type
|
||||
operator()(typename _Operation::first_argument_type& __x) const
|
||||
{ return op(__x, value); }
|
||||
} _GLIBCXX_DEPRECATED;
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation, typename _Tp>
|
||||
inline binder2nd<_Operation>
|
||||
bind2nd(const _Operation& __fn, const _Tp& __x)
|
||||
{
|
||||
typedef typename _Operation::second_argument_type _Arg2_type;
|
||||
return binder2nd<_Operation>(__fn, _Arg2_type(__x));
|
||||
}
|
||||
/** @} */
|
||||
|
||||
_GLIBCXX_END_NAMESPACE
|
||||
|
||||
#endif /* _GLIBCXX_BINDERS_H */
|
|
@ -42,11 +42,11 @@
|
|||
|
||||
// WARNING: The classes defined in this header are DEPRECATED. This
|
||||
// header is defined in section D.7.1 of the C++ standard, and it
|
||||
// MAY BE REMOVED in a future standard revision. You should use the
|
||||
// MAY BE REMOVED in a future standard revision. One should use the
|
||||
// header <sstream> instead.
|
||||
|
||||
#ifndef __SGI_STL_STRSTREAM
|
||||
#define __SGI_STL_STRSTREAM
|
||||
#ifndef _GLIBCXX_STRSTREAM
|
||||
#define _GLIBCXX_STRSTREAM
|
||||
|
||||
#include "backward_warning.h"
|
||||
#include <iosfwd>
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
// The current version of the C++ library in compressed ISO date format.
|
||||
#define __GLIBCXX__
|
||||
|
||||
// Macros for visibility support.
|
||||
// Macros for visibility.
|
||||
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
|
||||
// _GLIBCXX_VISIBILITY
|
||||
#define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
|
||||
|
||||
#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
|
||||
|
@ -54,6 +56,24 @@
|
|||
# define _GLIBCXX_VISIBILITY(V)
|
||||
#endif
|
||||
|
||||
// Macros for deprecated.
|
||||
// _GLIBCXX_USE_DEPRECATED
|
||||
// _GLIBCXX_DEPRECATED
|
||||
#ifndef _GLIBCXX_USE_DEPRECATED
|
||||
# define _GLIBCXX_USE_DEPRECATED 1
|
||||
#endif
|
||||
|
||||
#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#else
|
||||
# define _GLIBCXX_DEPRECATED
|
||||
#endif
|
||||
|
||||
// Macros for activating various namespace association modes.
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
|
||||
|
||||
// Guide to libstdc++ namespaces.
|
||||
/*
|
||||
namespace std
|
||||
|
@ -67,11 +87,6 @@
|
|||
}
|
||||
*/
|
||||
|
||||
// Macros for activating various namespace association modes.
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
|
||||
// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
|
||||
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
|
||||
#endif
|
||||
|
@ -89,8 +104,8 @@
|
|||
# define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1
|
||||
#endif
|
||||
|
||||
// Macros for namespace scope. Either namespace std:: or __gnu_cxx::,
|
||||
// or the name of some nested namespace within it.
|
||||
// Macros for namespace scope. Either namespace std:: or the name
|
||||
// of some nested namespace within it.
|
||||
// _GLIBCXX_STD
|
||||
// _GLIBCXX_STD_D
|
||||
// _GLIBCXX_STD_P
|
||||
|
|
|
@ -386,108 +386,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
{ return binary_negate<_Predicate>(__pred); }
|
||||
/** @} */
|
||||
|
||||
// 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), ...
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Creator-wrapper functions like @c bind1st are intended to be used in
|
||||
* 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).
|
||||
*
|
||||
* These become more useful when combined with the composition functions.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation>
|
||||
class binder1st
|
||||
: public unary_function<typename _Operation::second_argument_type,
|
||||
typename _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
typename _Operation::first_argument_type value;
|
||||
|
||||
public:
|
||||
binder1st(const _Operation& __x,
|
||||
const typename _Operation::first_argument_type& __y)
|
||||
: op(__x), value(__y) { }
|
||||
|
||||
typename _Operation::result_type
|
||||
operator()(const typename _Operation::second_argument_type& __x) const
|
||||
{ return op(value, __x); }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 109. Missing binders for non-const sequence elements
|
||||
typename _Operation::result_type
|
||||
operator()(typename _Operation::second_argument_type& __x) const
|
||||
{ return op(value, __x); }
|
||||
};
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation, typename _Tp>
|
||||
inline binder1st<_Operation>
|
||||
bind1st(const _Operation& __fn, const _Tp& __x)
|
||||
{
|
||||
typedef typename _Operation::first_argument_type _Arg1_type;
|
||||
return binder1st<_Operation>(__fn, _Arg1_type(__x));
|
||||
}
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation>
|
||||
class binder2nd
|
||||
: public unary_function<typename _Operation::first_argument_type,
|
||||
typename _Operation::result_type>
|
||||
{
|
||||
protected:
|
||||
_Operation op;
|
||||
typename _Operation::second_argument_type value;
|
||||
|
||||
public:
|
||||
binder2nd(const _Operation& __x,
|
||||
const typename _Operation::second_argument_type& __y)
|
||||
: op(__x), value(__y) { }
|
||||
|
||||
typename _Operation::result_type
|
||||
operator()(const typename _Operation::first_argument_type& __x) const
|
||||
{ return op(__x, value); }
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 109. Missing binders for non-const sequence elements
|
||||
typename _Operation::result_type
|
||||
operator()(typename _Operation::first_argument_type& __x) const
|
||||
{ return op(__x, value); }
|
||||
};
|
||||
|
||||
/// One of the @link s20_3_6_binder binder functors@endlink.
|
||||
template<typename _Operation, typename _Tp>
|
||||
inline binder2nd<_Operation>
|
||||
bind2nd(const _Operation& __fn, const _Tp& __x)
|
||||
{
|
||||
typedef typename _Operation::second_argument_type _Arg2_type;
|
||||
return binder2nd<_Operation>(__fn, _Arg2_type(__x));
|
||||
}
|
||||
/** @} */
|
||||
|
||||
// 20.3.7 adaptors pointers functions
|
||||
/** @defgroup s20_3_7_adaptors Adaptors for pointers to functions
|
||||
* The advantage of function objects over pointers to functions is that
|
||||
|
@ -802,4 +700,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
|
||||
_GLIBCXX_END_NAMESPACE
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
# include <backward/binders.h>
|
||||
#endif
|
||||
|
||||
#endif /* _STL_FUNCTION_H */
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include <bits/stl_construct.h>
|
||||
#include <bits/stl_uninitialized.h>
|
||||
#include <bits/stl_tempbuf.h>
|
||||
#include <bits/stl_auto_ptr.h>
|
||||
#include <bits/stl_raw_storage_iter.h>
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
@ -73,6 +72,9 @@
|
|||
# include <bits/stl_function.h> // std::less
|
||||
# include <debug/debug.h>
|
||||
# include <type_traits>
|
||||
# if _GLIBCXX_USE_DEPRECATED
|
||||
# include <backward/auto_ptr.h>
|
||||
# endif
|
||||
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
|
||||
# include <tr1_impl/boost_shared_ptr.h>
|
||||
# else
|
||||
|
@ -86,6 +88,8 @@
|
|||
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||
# undef _GLIBCXX_INCLUDE_AS_CXX0X
|
||||
# endif
|
||||
#else
|
||||
# include <backward/auto_ptr.h>
|
||||
#endif
|
||||
|
||||
#endif /* _GLIBCXX_MEMORY */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Stream buffer classes -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
// Free Software Foundation, Inc.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
// 2006, 2007 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
|
||||
|
@ -763,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
overflow(int_type /* __c */ = traits_type::eof())
|
||||
{ return traits_type::eof(); }
|
||||
|
||||
#ifdef _GLIBCXX_DEPRECATED
|
||||
#if _GLIBCXX_USE_DEPRECATED
|
||||
// Annex D.6
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -277,6 +277,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
|
||||
template<typename _Tp>
|
||||
explicit
|
||||
|
@ -284,7 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
: _M_pi(new _Sp_counted_base_impl<_Tp*,
|
||||
_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
|
||||
{ __r.release(); }
|
||||
|
||||
#endif
|
||||
|
||||
// Throw bad_weak_ptr when __r._M_get_use_count() == 0.
|
||||
explicit
|
||||
__shared_count(const __weak_count<_Lp>& __r);
|
||||
|
@ -578,6 +580,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
/**
|
||||
* @post use_count() == 1 and __r.get() == 0
|
||||
*/
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
template<typename _Tp1>
|
||||
explicit
|
||||
__shared_ptr(std::auto_ptr<_Tp1>& __r)
|
||||
|
@ -589,6 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
_M_refcount = __shared_count<_Lp>(__r);
|
||||
__enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename _Tp1>
|
||||
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag)
|
||||
|
@ -620,6 +624,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
template<typename _Tp1>
|
||||
__shared_ptr&
|
||||
operator=(std::auto_ptr<_Tp1>& __r)
|
||||
|
@ -627,6 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
__shared_ptr(__r).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
reset() // never throws
|
||||
|
@ -993,10 +999,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
shared_ptr(const weak_ptr<_Tp1>& __r)
|
||||
: __shared_ptr<_Tp>(__r) { }
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
template<typename _Tp1>
|
||||
explicit
|
||||
shared_ptr(std::auto_ptr<_Tp1>& __r)
|
||||
: __shared_ptr<_Tp>(__r) { }
|
||||
#endif
|
||||
|
||||
template<typename _Tp1>
|
||||
shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag)
|
||||
|
@ -1018,6 +1026,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
|
||||
template<typename _Tp1>
|
||||
shared_ptr&
|
||||
operator=(std::auto_ptr<_Tp1>& __r)
|
||||
|
@ -1025,6 +1034,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
this->__shared_ptr<_Tp>::operator=(__r);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Tp1>
|
||||
|
|
Loading…
Add table
Reference in a new issue