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/const-object/driver.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'common/const-object/driver.cxx') diff --git a/common/const-object/driver.cxx b/common/const-object/driver.cxx index 03b9c20..cbe5b72 100644 --- a/common/const-object/driver.cxx +++ b/common/const-object/driver.cxx @@ -37,10 +37,18 @@ main (int argc, char* argv[]) const obj1* co1 (co1_); a.o1 = co1; +#ifdef HAVE_CXX11 + unique_ptr o2 (new obj2 (1)); +#else auto_ptr o2 (new obj2 (1)); +#endif obj2* co2_ (new obj2 (2)); a.o2.reset (co2_); +#ifdef HAVE_CXX11 + unique_ptr& co2 (a.o2); +#else auto_ptr& co2 (a.o2); +#endif // persist via references // @@ -75,8 +83,15 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); + +#ifdef HAVE_CXX11 + unique_ptr a (db->load (1)); + unique_ptr ca (db->load (2)); +#else auto_ptr a (db->load (1)); auto_ptr ca (db->load (2)); +#endif + t.commit (); assert (a->o1->id == 2); @@ -146,8 +161,13 @@ main (int argc, char* argv[]) { // i->f (); // error i->cf (); +#ifdef HAVE_CXX11 + //unique_ptr p (i.load ()); // error + unique_ptr p (i.load ()); +#else // auto_ptr p (i.load ()); // error auto_ptr p (i.load ()); +#endif obj2 o (0); i.load (o); assert (p->id == o.id); -- cgit v1.1