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.txx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'libxsd/xsd/cxx/tree/containers.txx') diff --git a/libxsd/xsd/cxx/tree/containers.txx b/libxsd/xsd/cxx/tree/containers.txx index a27af48..7e45a02 100644 --- a/libxsd/xsd/cxx/tree/containers.txx +++ b/libxsd/xsd/cxx/tree/containers.txx @@ -4,6 +4,11 @@ // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include + +#ifdef XSD_CXX11 +# include // std::move +#endif + #include namespace xsd @@ -38,10 +43,14 @@ namespace xsd template one:: - one (std::auto_ptr x, container* c) + one (XSD_AUTO_PTR x, container* c) : x_ (0), container_ (c) { +#ifdef XSD_CXX11 + set (std::move (x)); +#else set (x); +#endif } template @@ -86,7 +95,7 @@ namespace xsd template void one:: - set (std::auto_ptr x) + set (XSD_AUTO_PTR x) { T* r (0); @@ -128,10 +137,14 @@ namespace xsd template optional:: - optional (std::auto_ptr x, container* c) + optional (XSD_AUTO_PTR x, container* c) : x_ (0), container_ (c) { +#ifdef XSD_CXX11 + set (std::move (x)); +#else set (x); +#endif } template @@ -185,7 +198,7 @@ namespace xsd template void optional:: - set (std::auto_ptr x) + set (XSD_AUTO_PTR x) { T* r (0); -- cgit v1.1