From 72f9ee644d3a048e68ba9570a096b6dd12c5ee1a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Jun 2016 18:50:51 +0200 Subject: Get rid of C++11 deprecation warnings for auto_ptr, exception specs In particular, std::auto_ptr is no longer mapped in C++11. --- common/bulk/driver.cxx | 28 ++++++++++++++-------------- common/bulk/test.hxx | 26 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'common/bulk') diff --git a/common/bulk/driver.cxx b/common/bulk/driver.cxx index 06bd06c..d6a294a 100644 --- a/common/bulk/driver.cxx +++ b/common/bulk/driver.cxx @@ -327,13 +327,6 @@ main (int argc, char* argv[]) test (db, v.begin (), v.end ()); } - { - auto_ptr a[2]; - a[0].reset (new auto_object (1, "a")); - a[1].reset (new auto_object (2, "b")); - test (db, a, a + sizeof (a) / sizeof (a[0])); - } - #ifdef HAVE_CXX11 { vector> v; @@ -341,6 +334,13 @@ main (int argc, char* argv[]) v.push_back (unique_ptr (new unique_object (2, "b"))); test (db, v.begin (), v.end ()); } +#else + { + auto_ptr a[2]; + a[0].reset (new auto_object (1, "a")); + a[1].reset (new auto_object (2, "b")); + test (db, a, a + sizeof (a) / sizeof (a[0])); + } #endif { @@ -981,13 +981,6 @@ main (int argc, char* argv[]) test (db, v.begin (), v.end ()); } - { - auto_ptr a[2]; - a[0].reset (new auto_object (1, "a")); - a[1].reset (new auto_object (2, "b")); - test (db, a, a + sizeof (a) / sizeof (a[0])); - } - #ifdef HAVE_CXX11 { vector> v; @@ -995,6 +988,13 @@ main (int argc, char* argv[]) v.push_back (unique_ptr (new unique_object (2, "b"))); test (db, v.begin (), v.end ()); } +#else + { + auto_ptr a[2]; + a[0].reset (new auto_object (1, "a")); + a[1].reset (new auto_object (2, "b")); + test (db, a, a + sizeof (a) / sizeof (a[0])); + } #endif { diff --git a/common/bulk/test.hxx b/common/bulk/test.hxx index 85cb5c3..ce55158 100644 --- a/common/bulk/test.hxx +++ b/common/bulk/test.hxx @@ -32,10 +32,11 @@ namespace test1 std::string s; }; - #pragma db object bulk(3) pointer(std::auto_ptr) - struct auto_object +#ifdef HAVE_CXX11 + #pragma db object bulk(3) pointer(std::unique_ptr) + struct unique_object { - auto_object (unsigned int n_ = 0, std::string s_ = "") + unique_object (unsigned int n_ = 0, std::string s_ = "") : id (0), n (n_), s (s_) {} #pragma db id auto @@ -44,12 +45,11 @@ namespace test1 unsigned int n; std::string s; }; - -#ifdef HAVE_CXX11 - #pragma db object bulk(3) pointer(std::unique_ptr) - struct unique_object +#else + #pragma db object bulk(3) pointer(std::auto_ptr) + struct auto_object { - unique_object (unsigned int n_ = 0, std::string s_ = "") + auto_object (unsigned int n_ = 0, std::string s_ = "") : id (0), n (n_), s (s_) {} #pragma db id auto @@ -176,16 +176,16 @@ namespace test6 #pragma db object(object) bulk(3) #pragma db member(object::id) id auto - typedef object_template<2> auto_object; - - #pragma db object(auto_object) bulk(3) pointer(std::auto_ptr) - #pragma db member(auto_object::id) id auto - #ifdef HAVE_CXX11 typedef object_template<3> unique_object; #pragma db object(unique_object) bulk(3) pointer(std::unique_ptr) #pragma db member(unique_object::id) id auto +#else + typedef object_template<2> auto_object; + + #pragma db object(auto_object) bulk(3) pointer(std::auto_ptr) + #pragma db member(auto_object::id) id auto #endif } -- cgit v1.1