summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/memory
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-04 21:27:36 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-04 21:27:36 +0000
commite1e0016d0d1995123526b8a248d388c06644541b (patch)
treef9b7a5cf7ab77ab1aa83870039157784eb5398b3 /libstdc++-v3/include/std/memory
parentb41d83cb0e696d0b8687c24362515f99a89e63cb (diff)
downloadppe42-gcc-e1e0016d0d1995123526b8a248d388c06644541b.tar.gz
ppe42-gcc-e1e0016d0d1995123526b8a248d388c06644541b.zip
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list. (c_base_srcdir): No bits subdirectory. (c_base_builddir): Same. (c_base_headers): Adjust names, add ciso646. (bits_headers): Remove std_xxx.h headers. * include/Makefile.in: Regenerate. * include/ext/iterator: Adjust includes. * include/ext/ropeimpl.h: Same. * include/ext/stl_hash_fun.h: Same. * include/ext/algorithm: Same. * include/backward/bvector.h: Adjust includes. * include/backward/vector.h: Same. * include/backward/strstream: Same. * include/backward/streambuf.h: Same. * include/backward/stack.h: Same. * include/backward/set.h: Same. * include/backward/queue.h: Same. * include/backward/multiset.h: Same. * include/backward/multimap.h: Same. * include/backward/map.h: Same. * include/backward/list.h: Same. * include/backward/iterator.h: Same. * include/backward/iostream.h: Same. * include/backward/iomanip.h: Same. * include/backward/fstream.h: Same. * include/backward/deque.h: Same. * include/backward/complex.h: Same. * include/bits/std_algorithm.h: Move to... * include/std/algorithm: ...here. * include/bits/std_iosfwd.h, std_locale.h, std_stack.h, std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h, std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h, std_deque.h, std_istream.h, std_numeric.h, std_string.h, std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h, std_queue.h, std_valarray.h, std_functional.h, std_limits.h, std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h: Same. * include/c_std/bits/std_cassert.h: Move to... * include/c_std/cassert: Here. * include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c_std/cmath: Adjust cmath.tcc include. * include/c_std/cstdlib: Adjust includes. * include/c_std/cwchar: Same. * include/c_std/ctime: Same. * include/c_std/cstring: Same. * include/c_std/cstdio: Same. * include/c_std/bits: Remove directory. * include/c/bits/std_cassert.h: Move to... * include/c/cassert: Here. * include/c/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c/bits: Remove directory. * include/std/cwctype: Remove. * include/std/cwchar: Remove. * include/std/ctime: Remove. * include/std/cstring: Remove. * include/std/cstdlib: Remove. * include/std/cstdio: Remove. * include/std/cstddef: Remove. * include/std/cstdarg: Remove. * include/std/csignal: Remove. * include/std/csetjmp: Remove. * include/std/cmath: Remove. * include/std/clocale: Remove. * include/std/climits: Remove. * include/std/ciso646: Remove. * include/std/cfloat: Remove. * include/std/cerrno: Remove. * include/std/cctype: Remove. * include/std/cassert: Remove. * include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h> files and subsituting <.xxx> * include/bits/valarray_array.h: Same. * include/bits/stl_uninitialized.h: Same. * include/bits/stl_alloc.h: Same. * include/bits/stl_algobase.h: Same. * include/bits/sstream.tcc: Same. * include/bits/pthread_allocimpl.h: Same. * include/bits/ostream.tcc: Same. * include/bits/localefwd.h: Same. * include/bits/locale_facets.tcc: Same. * include/bits/locale_facets.h: Same. * include/bits/istream.tcc: Same. * include/bits/char_traits.h: Same. * include/bits/boost_concept_check.h: Same. * include/bits/basic_file.h: Same. * include/std/bitset: Same. * include/std/complex: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/ios: Same. * include/std/iostream: Same. * include/std/ostream: Same. * include/std/sstream: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/iterator: Same. * include/std/valarray: Same. * src/ios.cc: Adjust includes. * src/valarray-inst.cc: Same. * src/string-inst.cc: Same. * src/stl-inst.cc: Same. * src/stdexcept.cc: Same. * src/misc-inst.cc: Same. * src/localename.cc: Same. * src/locale-inst.cc: Same. * src/locale.cc: Same. * src/limits.cc: Same. * src/concept-inst.cc: Same. * src/complex_io.cc: Same. * src/codecvt.cc: Same. * src/bitset.cc: Same. * src/cmath.cc: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48544 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/memory')
-rw-r--r--libstdc++-v3/include/std/memory124
1 files changed, 118 insertions, 6 deletions
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index a52f4921d92..c9a2e59e48e 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -1,4 +1,4 @@
-// -*- C++ -*- std header.
+// <memory> -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc.
//
@@ -27,11 +27,123 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
-/** @file memory
- * This is a Standard C++ Library file. You should @c #include this file
- * in your programs, rather than any of the "st[dl]_*.h" implementation files.
+/*
+ * Copyright (c) 1997-1999
+ * 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 std_memory.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
*/
#ifndef _CPP_MEMORY
-#include <bits/std_memory.h>
-#endif
+#define _CPP_MEMORY 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_iterator_base_types.h> //for iterator_traits
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_raw_storage_iter.h>
+
+namespace std
+{
+
+ template<class _Tp1> struct auto_ptr_ref {
+ _Tp1* _M_ptr;
+ auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
+};
+
+/**
+ * A simple smart pointer providing strict ownership semantics. (More later.)
+*/
+template <class _Tp> class auto_ptr {
+private:
+ _Tp* _M_ptr;
+
+public:
+ typedef _Tp element_type;
+
+ explicit auto_ptr(_Tp* __p = 0) throw() : _M_ptr(__p) {}
+ auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) {}
+
+ template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) throw()
+ : _M_ptr(__a.release()) {}
+
+ auto_ptr& operator=(auto_ptr& __a) throw() {
+ reset(__a.release());
+ return *this;
+ }
+
+ template <class _Tp1>
+ auto_ptr& operator=(auto_ptr<_Tp1>& __a) throw() {
+ reset(__a.release());
+ return *this;
+ }
+
+ // Note: 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 (17.4.3.6/2)
+ // this is prohibited.
+ ~auto_ptr() { delete _M_ptr; }
+
+ _Tp& operator*() const throw() {
+ return *_M_ptr;
+ }
+ _Tp* operator->() const throw() {
+ return _M_ptr;
+ }
+ _Tp* get() const throw() {
+ return _M_ptr;
+ }
+ _Tp* release() throw() {
+ _Tp* __tmp = _M_ptr;
+ _M_ptr = 0;
+ return __tmp;
+ }
+ void reset(_Tp* __p = 0) throw() {
+ if (__p != _M_ptr) {
+ delete _M_ptr;
+ _M_ptr = __p;
+ }
+ }
+
+public:
+ auto_ptr(auto_ptr_ref<_Tp> __ref) throw()
+ : _M_ptr(__ref._M_ptr) {}
+
+ auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) throw() {
+ if (__ref._M_ptr != this->get()) {
+ delete _M_ptr;
+ _M_ptr = __ref._M_ptr;
+ }
+ return *this;
+ }
+
+ template <class _Tp1> operator auto_ptr_ref<_Tp1>() throw()
+ { return auto_ptr_ref<_Tp>(this->release()); }
+ template <class _Tp1> operator auto_ptr<_Tp1>() throw()
+ { return auto_ptr<_Tp1>(this->release()); }
+};
+
+} // namespace std
+
+#endif /* _CPP_MEMORY */
+
+
+// Local Variables:
+// mode:C++
+// End:
OpenPOWER on IntegriCloud