From 0fdf19714613a82a184f4f6e75fb9a4f9b62f18a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 19 Jan 2014 10:05:08 +0200 Subject: Use std::unique_ptr instead of std::auto_ptr in C++11 mode --- libxsd/xsd/cxx/tree/containers.hxx | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'libxsd/xsd/cxx/tree/containers.hxx') diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx index e6b9f88..1b959cb 100644 --- a/libxsd/xsd/cxx/tree/containers.hxx +++ b/libxsd/xsd/cxx/tree/containers.hxx @@ -9,11 +9,13 @@ #include // std::ptrdiff_t #include #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::iterator_traits #include // std::equal, std::lexicographical_compare #include +#include // XSD_AUTO_PTR + #include namespace xsd @@ -136,7 +138,7 @@ namespace xsd one (const T&, container*); - one (std::auto_ptr, container*); + one (XSD_AUTO_PTR, container*); one (const one&, flags, container*); @@ -163,7 +165,7 @@ namespace xsd } void - set (std::auto_ptr); + set (XSD_AUTO_PTR); bool present () const @@ -171,13 +173,13 @@ namespace xsd return x_ != 0; } - std::auto_ptr + XSD_AUTO_PTR detach () { T* x (x_); x->_container (0); x_ = 0; - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } protected: @@ -268,7 +270,7 @@ namespace xsd optional (const T&, container* = 0); explicit - optional (std::auto_ptr, container* = 0); + optional (XSD_AUTO_PTR, container* = 0); optional (const optional&, flags = 0, container* = 0); @@ -341,18 +343,18 @@ namespace xsd } void - set (std::auto_ptr); + set (XSD_AUTO_PTR); void reset (); - std::auto_ptr + XSD_AUTO_PTR detach () { T* x (x_); x->_container (0); x_ = 0; - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } protected: @@ -1266,7 +1268,7 @@ namespace xsd } void - push_back (std::auto_ptr x) + push_back (XSD_AUTO_PTR x) { if (x->_container () != container_) x->_container (container_); @@ -1280,7 +1282,7 @@ namespace xsd v_.pop_back (); } - std::auto_ptr + XSD_AUTO_PTR detach_back (bool pop = true) { ptr& p (v_.back ()); @@ -1290,7 +1292,7 @@ namespace xsd if (pop) v_.pop_back (); - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } iterator @@ -1302,7 +1304,7 @@ namespace xsd } iterator - insert (iterator position, std::auto_ptr x) + insert (iterator position, XSD_AUTO_PTR x) { if (x->_container () != container_) x->_container (container_); @@ -1336,12 +1338,11 @@ namespace xsd } iterator - detach (iterator position, std::auto_ptr& r, bool erase = true) + detach (iterator position, XSD_AUTO_PTR& r, bool erase = true) { ptr& p (*position.base ()); p->_container (0); - std::auto_ptr tmp (static_cast (p.release ())); - r = tmp; + r.reset (static_cast (p.release ())); if (erase) return iterator (v_.erase (position.base ())); -- cgit v1.1