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 --- tests/cxx/tree/complex/ctor/driver.cxx | 50 +++++++++++++++++++++------------- tests/cxx/tree/complex/ctor/makefile | 6 +++- 2 files changed, 36 insertions(+), 20 deletions(-) (limited to 'tests/cxx/tree/complex') diff --git a/tests/cxx/tree/complex/ctor/driver.cxx b/tests/cxx/tree/complex/ctor/driver.cxx index ea9695d..2adeec4 100644 --- a/tests/cxx/tree/complex/ctor/driver.cxx +++ b/tests/cxx/tree/complex/ctor/driver.cxx @@ -11,6 +11,13 @@ #include "test.hxx" +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; @@ -64,12 +71,12 @@ main () // e_base b1 (1, "foo", e_complex_type ("bar")); - auto_ptr c2 (new e_complex_type ("bar")); - e_base b2 (1, "foo", c2); + XSD_AUTO_PTR c2 (new e_complex_type ("bar")); + e_base b2 (1, "foo", XSD_MOVE (c2)); - auto_ptr s3 (new e_simple_type ("foo")); - auto_ptr c3 (new e_complex_type ("bar")); - e_base b3 (1, s3, c3); + XSD_AUTO_PTR s3 (new e_simple_type ("foo")); + XSD_AUTO_PTR c3 (new e_complex_type ("bar")); + e_base b3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); assert (b1 == b2); assert (b1 == b3); @@ -79,15 +86,20 @@ main () e_derived d1 (1, "foo", e_complex_type ("bar"), true, "baz", e_complex_type ("biz")); - auto_ptr c2a (new e_complex_type ("bar")); - auto_ptr c2b (new e_complex_type ("biz")); - e_derived d2 (1, "foo", c2a, true, "baz", c2b); - - auto_ptr s3a (new e_simple_type ("foo")); - auto_ptr s3b (new xml_schema::string ("baz")); - auto_ptr c3a (new e_complex_type ("bar")); - auto_ptr c3b (new e_complex_type ("biz")); - e_derived d3 (1, s3a, c3a, true, s3b, c3b); + XSD_AUTO_PTR c2a (new e_complex_type ("bar")); + XSD_AUTO_PTR c2b (new e_complex_type ("biz")); + e_derived d2 (1, "foo", XSD_MOVE (c2a), true, "baz", XSD_MOVE (c2b)); + + XSD_AUTO_PTR s3a (new e_simple_type ("foo")); + XSD_AUTO_PTR s3b (new xml_schema::string ("baz")); + XSD_AUTO_PTR c3a (new e_complex_type ("bar")); + XSD_AUTO_PTR c3b (new e_complex_type ("biz")); + e_derived d3 (1, + XSD_MOVE (s3a), + XSD_MOVE (c3a), + true, + XSD_MOVE (s3b), + XSD_MOVE (c3b)); assert (d1 == d2); assert (d1 == d3); @@ -99,12 +111,12 @@ main () { f_type f1 (xml_schema::type (), 1, "foo", f_complex_type ("bar")); - auto_ptr c2 (new f_complex_type ("bar")); - f_type f2 (1, "foo", c2); + XSD_AUTO_PTR c2 (new f_complex_type ("bar")); + f_type f2 (1, "foo", XSD_MOVE (c2)); - auto_ptr s3 (new f_simple_type ("foo")); - auto_ptr c3 (new f_complex_type ("bar")); - f_type f3 (1, s3, c3); + XSD_AUTO_PTR s3 (new f_simple_type ("foo")); + XSD_AUTO_PTR c3 (new f_complex_type ("bar")); + f_type f3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); assert (f1 == f2); assert (f1 == f3); diff --git a/tests/cxx/tree/complex/ctor/makefile b/tests/cxx/tree/complex/ctor/makefile index 6408105..1b0bc11 100644 --- a/tests/cxx/tree/complex/ctor/makefile +++ b/tests/cxx/tree/complex/ctor/makefile @@ -76,8 +76,12 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) +$(call include,$(bld_root)/cxx/standard.make) # cxx_standard +ifdef cxx_standard +$(gen): xsd_options += --std $(cxx_standard) +$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) +endif # Dependencies. # -- cgit v1.1