aboutsummaryrefslogtreecommitdiff
path: root/common/const-object/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-06-15 18:50:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-06-15 18:50:51 +0200
commit72f9ee644d3a048e68ba9570a096b6dd12c5ee1a (patch)
tree5670eaa8c20845b401c0b09bd0d643b971c675d9 /common/const-object/driver.cxx
parent766b7533addb5c981b135640321c291be270d907 (diff)
Get rid of C++11 deprecation warnings for auto_ptr, exception specs
In particular, std::auto_ptr is no longer mapped in C++11.
Diffstat (limited to 'common/const-object/driver.cxx')
-rw-r--r--common/const-object/driver.cxx20
1 files changed, 20 insertions, 0 deletions
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<obj2> o2 (new obj2 (1));
+#else
auto_ptr<obj2> o2 (new obj2 (1));
+#endif
obj2* co2_ (new obj2 (2));
a.o2.reset (co2_);
+#ifdef HAVE_CXX11
+ unique_ptr<const obj2>& co2 (a.o2);
+#else
auto_ptr<const obj2>& 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<aggr> a (db->load<aggr> (1));
+ unique_ptr<const aggr> ca (db->load<aggr> (2));
+#else
auto_ptr<aggr> a (db->load<aggr> (1));
auto_ptr<const aggr> ca (db->load<aggr> (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<obj2> p (i.load ()); // error
+ unique_ptr<const obj2> p (i.load ());
+#else
// auto_ptr<obj2> p (i.load ()); // error
auto_ptr<const obj2> p (i.load ());
+#endif
obj2 o (0);
i.load (o);
assert (p->id == o.id);