summaryrefslogtreecommitdiff
path: root/xsd/libxsd/xsd/cxx/tree/containers.txx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/libxsd/xsd/cxx/tree/containers.txx')
-rw-r--r--xsd/libxsd/xsd/cxx/tree/containers.txx62
1 files changed, 37 insertions, 25 deletions
diff --git a/xsd/libxsd/xsd/cxx/tree/containers.txx b/xsd/libxsd/xsd/cxx/tree/containers.txx
index fdc0bfd..2a3573f 100644
--- a/xsd/libxsd/xsd/cxx/tree/containers.txx
+++ b/xsd/libxsd/xsd/cxx/tree/containers.txx
@@ -1,9 +1,13 @@
// file : xsd/cxx/tree/containers.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <ostream>
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xsd/cxx/tree/bits/literals.hxx>
namespace xsd
@@ -23,34 +27,38 @@ namespace xsd
template<typename T>
one<T, false>::
- one (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (container* c)
+ : x_ (0), container_ (c)
{
}
template<typename T>
one<T, false>::
- one (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template<typename T>
one<T, false>::
- one (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (XSD_AUTO_PTR<T> x, container* c)
+ : x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template<typename T>
one<T, false>::
one (const one<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x.present ())
- set (x.get ());
+ set (x.get (), f);
}
template<typename T>
@@ -73,12 +81,12 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -86,7 +94,7 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
@@ -113,34 +121,38 @@ namespace xsd
template <typename T>
optional<T, false>::
- optional (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (container* c)
+ : x_ (0), container_ (c)
{
}
template <typename T>
optional<T, false>::
- optional (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template <typename T>
optional<T, false>::
- optional (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (XSD_AUTO_PTR<T> x, container* c)
+ : x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template <typename T>
optional<T, false>::
optional (const optional<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x)
- set (*x);
+ set (*x, f);
}
template <typename T>
@@ -172,12 +184,12 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -185,7 +197,7 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
@@ -220,7 +232,7 @@ namespace xsd
//
template <typename T>
optional<T, true>::
- optional (const T& y, flags, container*)
+ optional (const T& y, container*)
: present_ (false)
{
set (y);