aboutsummaryrefslogtreecommitdiff
path: root/tests/cxx/tree/detach/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cxx/tree/detach/driver.cxx')
-rw-r--r--tests/cxx/tree/detach/driver.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/cxx/tree/detach/driver.cxx b/tests/cxx/tree/detach/driver.cxx
index 8317ac4..e752c13 100644
--- a/tests/cxx/tree/detach/driver.cxx
+++ b/tests/cxx/tree/detach/driver.cxx
@@ -6,17 +6,26 @@
// Test the detach functionality.
//
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cassert>
#include "test.hxx"
+#ifdef XSD_CXX11
+# include <utility> // std::move
+# define XSD_MOVE(x) std::move(x)
+#else
+# define XSD_MOVE(x) x
+#endif
+
using namespace std;
using namespace test;
int
main ()
{
+ using test::ref;
+
// Construct the model.
//
object o1 ("o1");
@@ -57,22 +66,22 @@ main ()
// Detach one.
//
- auto_ptr<subtree> p (m.detach_one ());
+ XSD_AUTO_PTR<subtree> p (m.detach_one ());
assert (p->_container () == 0);
assert (p->r ()[0].get () == &p->o ()[1]);
assert (m.opt ()->r ()[1].get () == 0);
- m.one (p);
+ m.one (XSD_MOVE (p));
assert (m.opt ()->r ()[1].get () == &m.one ().o ()[0]);
p = m.detach_one ();
model m1;
- m1.one (p);
+ m1.one (XSD_MOVE (p));
m1.opt (s2);
assert (m1.opt ()->r ()[1].get () == &m1.one ().o ()[0]);
p = m1.detach_one ();
- m.seq ().push_back (p);
+ m.seq ().push_back (XSD_MOVE (p));
// Detach opt.
//
@@ -82,7 +91,7 @@ main ()
assert (p->r ()[0].get () == &p->o ()[1]);
assert (m.seq ()[0].r ()[1].get () == 0);
- m.seq ().push_back (p);
+ m.seq ().push_back (XSD_MOVE (p));
// Detach seq.
//
@@ -91,7 +100,7 @@ main ()
assert (p->r ()[0].get () == &p->o ()[1]);
assert (m.seq ()[0].r ()[1].get () == 0);
- m.seq ().push_back (p);
+ m.seq ().push_back (XSD_MOVE (p));
assert (m.seq ()[0].r ()[1].get () == &m.seq ()[1].o ()[0]);
m.seq ().detach (m.seq ().begin (), p);