aboutsummaryrefslogtreecommitdiff
path: root/common/const-object/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/const-object/driver.cxx')
-rw-r--r--common/const-object/driver.cxx28
1 files changed, 6 insertions, 22 deletions
diff --git a/common/const-object/driver.cxx b/common/const-object/driver.cxx
index 90efb4e..7ef48ee 100644
--- a/common/const-object/driver.cxx
+++ b/common/const-object/driver.cxx
@@ -4,19 +4,21 @@
// Test database operations with const objects.
//
-#include <memory> // std::auto_ptr
-#include <cassert>
+#include <memory> // std::unique_ptr
#include <iostream>
#include <odb/database.hxx>
#include <odb/session.hxx>
#include <odb/transaction.hxx>
-#include <common/common.hxx>
+#include <libcommon/common.hxx>
#include "test.hxx"
#include "test-odb.hxx"
+#undef NDEBUG
+#include <cassert>
+
using namespace std;
using namespace odb::core;
@@ -25,7 +27,7 @@ main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ unique_ptr<database> db (create_database (argc, argv));
aggr a (1);
aggr ca_ (2); // o1 and o2 are NULL
@@ -36,18 +38,10 @@ 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
//
@@ -83,13 +77,8 @@ 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 ();
@@ -160,13 +149,8 @@ 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);