+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.
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*;
_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]*;
_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.
${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 \
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
${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 \
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
--- /dev/null
+// auto_ptr implementation -*- C++ -*-
+
+// Copyright (C) 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.
+
+/** @file backward/auto_ptr.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_AUTO_PTR_H
+#define _STL_AUTO_PTR_H 1
+
+#include <bits/c++config.h>
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * A wrapper class to provide auto_ptr with reference semantics.
+ * For example, an auto_ptr can be assigned (or constructed from)
+ * the result of a function which returns an auto_ptr by value.
+ *
+ * All the auto_ptr_ref stuff should happen behind the scenes.
+ */
+ template<typename _Tp1>
+ struct auto_ptr_ref
+ {
+ _Tp1* _M_ptr;
+
+ explicit
+ auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
+ } _GLIBCXX_DEPRECATED;
+
+
+ /**
+ * @brief A simple smart pointer providing strict ownership semantics.
+ *
+ * The Standard says:
+ * <pre>
+ * An @c auto_ptr owns the object it holds a pointer to. Copying
+ * an @c auto_ptr copies the pointer and transfers ownership to the
+ * destination. If more than one @c auto_ptr owns the same object
+ * at the same time the behavior of the program is undefined.
+ *
+ * The uses of @c auto_ptr include providing temporary
+ * exception-safety for dynamically allocated memory, passing
+ * ownership of dynamically allocated memory to a function, and
+ * returning dynamically allocated memory from a function. @c
+ * auto_ptr does not meet the CopyConstructible and Assignable
+ * requirements for Standard Library <a
+ * href="tables.html#65">container</a> elements and thus
+ * instantiating a Standard Library container with an @c auto_ptr
+ * results in undefined behavior.
+ * </pre>
+ * Quoted from [20.4.5]/3.
+ *
+ * Good examples of what can and cannot be done with auto_ptr can
+ * be found in the libstdc++ testsuite.
+ *
+ * @if maint
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * 127. auto_ptr<> conversion issues
+ * These resolutions have all been incorporated.
+ * @endif
+ */
+ template<typename _Tp>
+ class auto_ptr
+ {
+ private:
+ _Tp* _M_ptr;
+
+ public:
+ /// The pointed-to type.
+ typedef _Tp element_type;
+
+ /**
+ * @brief An %auto_ptr is usually constructed from a raw pointer.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p.
+ */
+ explicit
+ auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
+
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownsership.
+ */
+ auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
+
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a
+ * pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownsership.
+ */
+ template<typename _Tp1>
+ auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
+
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownsership. The object that this one @e
+ * used to own and track has been deleted.
+ */
+ auto_ptr&
+ operator=(auto_ptr& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownsership. The object that this one @e
+ * used to own and track has been deleted.
+ */
+ template<typename _Tp1>
+ auto_ptr&
+ operator=(auto_ptr<_Tp1>& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * When the %auto_ptr goes out of scope, the object it owns is
+ * deleted. If it no longer owns anything (i.e., @c get() is
+ * @c NULL), then this has no effect.
+ *
+ * @if maint
+ * The C++ standard says there is supposed to be an empty throw
+ * specification here, but omitting it is standard conforming. Its
+ * presence can be detected only if _Tp::~_Tp() throws, but this is
+ * prohibited. [17.4.3.6]/2
+ * @endif
+ */
+ ~auto_ptr() { delete _M_ptr; }
+
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * If this %auto_ptr no longer owns anything, then this
+ * operation will crash. (For a smart pointer, "no longer owns
+ * anything" is the same as being a null pointer, and you know
+ * what happens when you dereference one of those...)
+ */
+ element_type&
+ operator*() const throw()
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return *_M_ptr;
+ }
+
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * This returns the pointer itself, which the language then will
+ * automatically cause to be dereferenced.
+ */
+ element_type*
+ operator->() const throw()
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return _M_ptr;
+ }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts
+ * a raw pointer.
+ *
+ * @note This %auto_ptr still owns the memory.
+ */
+ element_type*
+ get() const throw() { return _M_ptr; }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts
+ * a raw pointer.
+ *
+ * @note This %auto_ptr no longer owns the memory. When this object
+ * goes out of scope, nothing will happen.
+ */
+ element_type*
+ release() throw()
+ {
+ element_type* __tmp = _M_ptr;
+ _M_ptr = 0;
+ return __tmp;
+ }
+
+ /**
+ * @brief Forcibly deletes the managed object.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p. The
+ * previous object has been deleted.
+ */
+ void
+ reset(element_type* __p = 0) throw()
+ {
+ if (__p != _M_ptr)
+ {
+ delete _M_ptr;
+ _M_ptr = __p;
+ }
+ }
+
+ /**
+ * @brief Automatic conversions
+ *
+ * These operations convert an %auto_ptr into and from an auto_ptr_ref
+ * automatically as needed. This allows constructs such as
+ * @code
+ * auto_ptr<Derived> func_returning_auto_ptr(.....);
+ * ...
+ * auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
+ * @endcode
+ */
+ auto_ptr(auto_ptr_ref<element_type> __ref) throw()
+ : _M_ptr(__ref._M_ptr) { }
+
+ auto_ptr&
+ operator=(auto_ptr_ref<element_type> __ref) throw()
+ {
+ if (__ref._M_ptr != this->get())
+ {
+ delete _M_ptr;
+ _M_ptr = __ref._M_ptr;
+ }
+ return *this;
+ }
+
+ template<typename _Tp1>
+ operator auto_ptr_ref<_Tp1>() throw()
+ { return auto_ptr_ref<_Tp1>(this->release()); }
+
+ 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
+ template<>
+ class auto_ptr<void>
+ {
+ public:
+ typedef void element_type;
+ } _GLIBCXX_DEPRECATED;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_AUTO_PTR_H */
#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
--- /dev/null
+// 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 */
// 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>
// 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
# 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
}
*/
-// 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
# 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
+++ /dev/null
-// auto_ptr implementation -*- C++ -*-
-
-// Copyright (C) 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.
-
-/** @file stl_auto_ptr.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STL_AUTO_PTR_H
-#define _STL_AUTO_PTR_H 1
-
-#include <bits/c++config.h>
-#include <debug/debug.h>
-
-_GLIBCXX_BEGIN_NAMESPACE(std)
-
- /**
- * A wrapper class to provide auto_ptr with reference semantics.
- * For example, an auto_ptr can be assigned (or constructed from)
- * the result of a function which returns an auto_ptr by value.
- *
- * All the auto_ptr_ref stuff should happen behind the scenes.
- */
- template<typename _Tp1>
- struct auto_ptr_ref
- {
- _Tp1* _M_ptr;
-
- explicit
- auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
- };
-
-
- /**
- * @brief A simple smart pointer providing strict ownership semantics.
- *
- * The Standard says:
- * <pre>
- * An @c auto_ptr owns the object it holds a pointer to. Copying
- * an @c auto_ptr copies the pointer and transfers ownership to the
- * destination. If more than one @c auto_ptr owns the same object
- * at the same time the behavior of the program is undefined.
- *
- * The uses of @c auto_ptr include providing temporary
- * exception-safety for dynamically allocated memory, passing
- * ownership of dynamically allocated memory to a function, and
- * returning dynamically allocated memory from a function. @c
- * auto_ptr does not meet the CopyConstructible and Assignable
- * requirements for Standard Library <a
- * href="tables.html#65">container</a> elements and thus
- * instantiating a Standard Library container with an @c auto_ptr
- * results in undefined behavior.
- * </pre>
- * Quoted from [20.4.5]/3.
- *
- * Good examples of what can and cannot be done with auto_ptr can
- * be found in the libstdc++ testsuite.
- *
- * @if maint
- * _GLIBCXX_RESOLVE_LIB_DEFECTS
- * 127. auto_ptr<> conversion issues
- * These resolutions have all been incorporated.
- * @endif
- */
- template<typename _Tp>
- class auto_ptr
- {
- private:
- _Tp* _M_ptr;
-
- public:
- /// The pointed-to type.
- typedef _Tp element_type;
-
- /**
- * @brief An %auto_ptr is usually constructed from a raw pointer.
- * @param p A pointer (defaults to NULL).
- *
- * This object now @e owns the object pointed to by @a p.
- */
- explicit
- auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
-
- /**
- * @brief An %auto_ptr can be constructed from another %auto_ptr.
- * @param a Another %auto_ptr of the same type.
- *
- * This object now @e owns the object previously owned by @a a,
- * which has given up ownsership.
- */
- auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
-
- /**
- * @brief An %auto_ptr can be constructed from another %auto_ptr.
- * @param a Another %auto_ptr of a different but related type.
- *
- * A pointer-to-Tp1 must be convertible to a
- * pointer-to-Tp/element_type.
- *
- * This object now @e owns the object previously owned by @a a,
- * which has given up ownsership.
- */
- template<typename _Tp1>
- auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
-
- /**
- * @brief %auto_ptr assignment operator.
- * @param a Another %auto_ptr of the same type.
- *
- * This object now @e owns the object previously owned by @a a,
- * which has given up ownsership. The object that this one @e
- * used to own and track has been deleted.
- */
- auto_ptr&
- operator=(auto_ptr& __a) throw()
- {
- reset(__a.release());
- return *this;
- }
-
- /**
- * @brief %auto_ptr assignment operator.
- * @param a Another %auto_ptr of a different but related type.
- *
- * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
- *
- * This object now @e owns the object previously owned by @a a,
- * which has given up ownsership. The object that this one @e
- * used to own and track has been deleted.
- */
- template<typename _Tp1>
- auto_ptr&
- operator=(auto_ptr<_Tp1>& __a) throw()
- {
- reset(__a.release());
- return *this;
- }
-
- /**
- * When the %auto_ptr goes out of scope, the object it owns is
- * deleted. If it no longer owns anything (i.e., @c get() is
- * @c NULL), then this has no effect.
- *
- * @if maint
- * The C++ standard says there is supposed to be an empty throw
- * specification here, but omitting it is standard conforming. Its
- * presence can be detected only if _Tp::~_Tp() throws, but this is
- * prohibited. [17.4.3.6]/2
- * @endif
- */
- ~auto_ptr() { delete _M_ptr; }
-
- /**
- * @brief Smart pointer dereferencing.
- *
- * If this %auto_ptr no longer owns anything, then this
- * operation will crash. (For a smart pointer, "no longer owns
- * anything" is the same as being a null pointer, and you know
- * what happens when you dereference one of those...)
- */
- element_type&
- operator*() const throw()
- {
- _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
- return *_M_ptr;
- }
-
- /**
- * @brief Smart pointer dereferencing.
- *
- * This returns the pointer itself, which the language then will
- * automatically cause to be dereferenced.
- */
- element_type*
- operator->() const throw()
- {
- _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
- return _M_ptr;
- }
-
- /**
- * @brief Bypassing the smart pointer.
- * @return The raw pointer being managed.
- *
- * You can get a copy of the pointer that this object owns, for
- * situations such as passing to a function which only accepts
- * a raw pointer.
- *
- * @note This %auto_ptr still owns the memory.
- */
- element_type*
- get() const throw() { return _M_ptr; }
-
- /**
- * @brief Bypassing the smart pointer.
- * @return The raw pointer being managed.
- *
- * You can get a copy of the pointer that this object owns, for
- * situations such as passing to a function which only accepts
- * a raw pointer.
- *
- * @note This %auto_ptr no longer owns the memory. When this object
- * goes out of scope, nothing will happen.
- */
- element_type*
- release() throw()
- {
- element_type* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
-
- /**
- * @brief Forcibly deletes the managed object.
- * @param p A pointer (defaults to NULL).
- *
- * This object now @e owns the object pointed to by @a p. The
- * previous object has been deleted.
- */
- void
- reset(element_type* __p = 0) throw()
- {
- if (__p != _M_ptr)
- {
- delete _M_ptr;
- _M_ptr = __p;
- }
- }
-
- /**
- * @brief Automatic conversions
- *
- * These operations convert an %auto_ptr into and from an auto_ptr_ref
- * automatically as needed. This allows constructs such as
- * @code
- * auto_ptr<Derived> func_returning_auto_ptr(.....);
- * ...
- * auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
- * @endcode
- */
- auto_ptr(auto_ptr_ref<element_type> __ref) throw()
- : _M_ptr(__ref._M_ptr) { }
-
- auto_ptr&
- operator=(auto_ptr_ref<element_type> __ref) throw()
- {
- if (__ref._M_ptr != this->get())
- {
- delete _M_ptr;
- _M_ptr = __ref._M_ptr;
- }
- return *this;
- }
-
- template<typename _Tp1>
- operator auto_ptr_ref<_Tp1>() throw()
- { return auto_ptr_ref<_Tp1>(this->release()); }
-
- template<typename _Tp1>
- operator auto_ptr<_Tp1>() throw()
- { return auto_ptr<_Tp1>(this->release()); }
- };
-
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 541. shared_ptr template assignment and void
- template<>
- class auto_ptr<void>
- {
- public:
- typedef void element_type;
- };
-
-_GLIBCXX_END_NAMESPACE
-
-#endif /* _STL_AUTO_PTR_H */
{ 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
_GLIBCXX_END_NAMESPACE
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
+# include <backward/binders.h>
+#endif
+
#endif /* _STL_FUNCTION_H */
#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__
# 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
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
+#else
+# include <backward/auto_ptr.h>
#endif
#endif /* _GLIBCXX_MEMORY */
// 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
overflow(int_type /* __c */ = traits_type::eof())
{ return traits_type::eof(); }
-#ifdef _GLIBCXX_DEPRECATED
+#if _GLIBCXX_USE_DEPRECATED
// Annex D.6
public:
/**
}
}
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
template<typename _Tp>
explicit
: _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);
/**
* @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)
_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)
return *this;
}
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
__shared_ptr&
operator=(std::auto_ptr<_Tp1>& __r)
__shared_ptr(__r).swap(*this);
return *this;
}
+#endif
void
reset() // never throws
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)
return *this;
}
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
shared_ptr&
operator=(std::auto_ptr<_Tp1>& __r)
this->__shared_ptr<_Tp>::operator=(__r);
return *this;
}
+#endif
};
template<typename _Tp, typename _Tp1>