aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--common/bulk/driver.cxx28
-rw-r--r--common/bulk/test.hxx26
-rw-r--r--common/const-member/test.hxx8
-rw-r--r--common/const-object/driver.cxx20
-rw-r--r--common/const-object/test.hxx11
-rw-r--r--common/container/change-tracking/driver.cxx15
-rw-r--r--common/container/change-tracking/test.hxx4
-rw-r--r--common/inheritance/polymorphism/driver.cxx110
-rw-r--r--common/inheritance/polymorphism/test5.hxx6
-rw-r--r--common/inheritance/polymorphism/test6.hxx10
-rw-r--r--common/prepared/driver.cxx12
-rw-r--r--common/query/basics/test.hxx6
-rw-r--r--common/readonly/test.hxx9
-rw-r--r--common/wrapper/test.hxx4
-rw-r--r--evolution/soft-delete/model.hxx8
-rw-r--r--mssql/types/test.hxx6
-rw-r--r--oracle/types/driver.cxx4
-rw-r--r--oracle/types/test.hxx7
-rw-r--r--qt/common/containers/change-tracking/driver.cxx12
-rw-r--r--qt/common/containers/change-tracking/test.hxx4
20 files changed, 278 insertions, 32 deletions
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<auto_object> 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<unique_ptr<unique_object>> v;
@@ -341,6 +334,13 @@ main (int argc, char* argv[])
v.push_back (unique_ptr<unique_object> (new unique_object (2, "b")));
test (db, v.begin (), v.end ());
}
+#else
+ {
+ auto_ptr<auto_object> 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<auto_object> 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<unique_ptr<unique_object>> v;
@@ -995,6 +988,13 @@ main (int argc, char* argv[])
v.push_back (unique_ptr<unique_object> (new unique_object (2, "b")));
test (db, v.begin (), v.end ());
}
+#else
+ {
+ auto_ptr<auto_object> 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
}
diff --git a/common/const-member/test.hxx b/common/const-member/test.hxx
index 1928572..c858bbb 100644
--- a/common/const-member/test.hxx
+++ b/common/const-member/test.hxx
@@ -5,6 +5,8 @@
#ifndef TEST_HXX
#define TEST_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <vector>
#include <string>
#include <memory> // std::auto_ptr
@@ -102,9 +104,15 @@ struct wrapper
#pragma db id
unsigned long id;
+#ifdef HAVE_CXX11
+ const std::unique_ptr<const std::string> str;
+ const std::unique_ptr<const wrapped_value> com;
+ const std::unique_ptr<const std::vector<unsigned long>> vec;
+#else
const std::auto_ptr<const std::string> str;
const std::auto_ptr<const wrapped_value> com;
const std::auto_ptr< const std::vector<unsigned long> > vec;
+#endif
};
#endif // TEST_HXX
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);
diff --git a/common/const-object/test.hxx b/common/const-object/test.hxx
index 93977f0..2e73d96 100644
--- a/common/const-object/test.hxx
+++ b/common/const-object/test.hxx
@@ -5,6 +5,8 @@
#ifndef TEST_HXX
#define TEST_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <memory>
#include <odb/core.hxx>
@@ -21,7 +23,11 @@ struct obj1
void cf () const {}
};
+#ifdef HAVE_CXX11
+#pragma db object pointer (std::unique_ptr<obj2>)
+#else
#pragma db object pointer (std::auto_ptr<obj2>)
+#endif
struct obj2
{
obj2 () {}
@@ -45,7 +51,12 @@ struct aggr
int id;
const obj1* o1;
+
+#ifdef HAVE_CXX11
+ std::unique_ptr<const obj2> o2;
+#else
std::auto_ptr<const obj2> o2;
+#endif
};
#endif // TEST_HXX
diff --git a/common/container/change-tracking/driver.cxx b/common/container/change-tracking/driver.cxx
index c5a43a4..3db728c 100644
--- a/common/container/change-tracking/driver.cxx
+++ b/common/container/change-tracking/driver.cxx
@@ -137,7 +137,11 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+#ifdef HAVE_CXX11
+ unique_ptr<object> p (db->load<object> ("1"));
+#else
auto_ptr<object> p (db->load<object> ("1"));
+#endif
assert (p->s._tracking ());
t.commit ();
}
@@ -551,7 +555,11 @@ main (int argc, char* argv[])
// Armed copy.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<object> c;
+#else
auto_ptr<object> c;
+#endif
{
o.s.pop_back ();
@@ -616,7 +624,7 @@ main (int argc, char* argv[])
//
#ifdef HAVE_CXX11
{
- auto_ptr<object> c;
+ unique_ptr<object> c;
{
o.s.pop_back ();
@@ -692,8 +700,13 @@ main (int argc, char* argv[])
{
session s;
transaction t (db->begin ());
+#ifdef HAVE_CXX11
+ unique_ptr<inv_object1> p1 (db->load<inv_object1> (o1.id_));
+ unique_ptr<inv_object2> p2 (db->load<inv_object2> (o2.id_));
+#else
auto_ptr<inv_object1> p1 (db->load<inv_object1> (o1.id_));
auto_ptr<inv_object2> p2 (db->load<inv_object2> (o2.id_));
+#endif
assert (p2->o1[0] == p1.get ());
assert (!p2->o1._tracking ());
t.commit ();
diff --git a/common/container/change-tracking/test.hxx b/common/container/change-tracking/test.hxx
index bcb6880..0117316 100644
--- a/common/container/change-tracking/test.hxx
+++ b/common/container/change-tracking/test.hxx
@@ -18,7 +18,11 @@
#include <odb/core.hxx>
#include <odb/vector.hxx>
+#ifdef HAVE_CXX11
+#pragma db object pointer(std::unique_ptr)
+#else
#pragma db object pointer(std::auto_ptr)
+#endif
struct object
{
object () {}
diff --git a/common/inheritance/polymorphism/driver.cxx b/common/inheritance/polymorphism/driver.cxx
index 3eec9b6..acf94d5 100644
--- a/common/inheritance/polymorphism/driver.cxx
+++ b/common/inheritance/polymorphism/driver.cxx
@@ -1029,7 +1029,11 @@ main (int argc, char* argv[])
// Root.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<root> p (db->load<root> (r.id));
+#else
auto_ptr<root> p (db->load<root> (r.id));
+#endif
r.num++;
r.strs.push_back ("aaaa");
@@ -1053,7 +1057,11 @@ main (int argc, char* argv[])
// Base.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<base> p (db->load<base> (b.id));
+#else
auto_ptr<base> p (db->load<base> (b.id));
+#endif
b.num++;
b.str += "b";
@@ -1081,7 +1089,11 @@ main (int argc, char* argv[])
// Derived.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<root> p (db->load<root> (d.id)); // Via root.
+#else
auto_ptr<root> p (db->load<root> (d.id)); // Via root.
+#endif
d.num++;
d.str += "d";
@@ -1145,7 +1157,11 @@ main (int argc, char* argv[])
// Root.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<root> p (db->load<root> (r.id));
+#else
auto_ptr<root> p (db->load<root> (r.id));
+#endif
r.num++;
r.strs.push_back ("aaaaa");
@@ -1165,7 +1181,11 @@ main (int argc, char* argv[])
// Base.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<base> p (db->load<base> (b.id));
+#else
auto_ptr<base> p (db->load<base> (b.id));
+#endif
b.num++;
b.str += "b";
@@ -1187,7 +1207,11 @@ main (int argc, char* argv[])
// Derived.
//
{
+#ifdef HAVE_CXX11
+ unique_ptr<root> p (db->load<root> (d.id)); // Via root.
+#else
auto_ptr<root> p (db->load<root> (d.id)); // Via root.
+#endif
d.num++;
d.str += "d";
@@ -1240,7 +1264,12 @@ main (int argc, char* argv[])
using namespace test6;
base b (1, 1, "bbb");
+
+#ifdef HAVE_CXX11
+ unique_ptr<base> d (new derived (2, 2, "ddd"));
+#else
auto_ptr<base> d (new derived (2, 2, "ddd"));
+#endif
// Persist.
//
@@ -1256,8 +1285,13 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
+#ifdef HAVE_CXX11
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<root> pd (db->load<root> (d->id));
+#else
auto_ptr<base> pb (db->load<base> (b.id));
auto_ptr<root> pd (db->load<root> (d->id));
+#endif
db->load (b.id, *pb);
db->load (d->id, *pd);
@@ -1319,7 +1353,12 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<root> p (db->load<root> (d.id));
+#else
auto_ptr<root> p (db->load<root> (d.id));
+#endif
t.commit ();
}
}
@@ -1479,9 +1518,15 @@ main (int argc, char* argv[])
// load (id)
//
+#ifdef HAVE_CXX11
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<interm> pd1 (db->load<interm> (d1.id));
+ unique_ptr<derived2> pd2 (db->load<derived2> (d2.id));
+#else
auto_ptr<root> pb (db->load<root> (b.id));
auto_ptr<interm> pd1 (db->load<interm> (d1.id));
auto_ptr<derived2> pd2 (db->load<derived2> (d2.id));
+#endif
assert (*pb == b);
assert (*pd1 == d1);
@@ -1563,9 +1608,17 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<root> pd1 (db->load<root> (d1.id));
+ unique_ptr<base> pd2 (db->load<base> (d2.id));
+#else
auto_ptr<base> pb (db->load<base> (b.id));
auto_ptr<root> pd1 (db->load<root> (d1.id));
auto_ptr<base> pd2 (db->load<base> (d2.id));
+#endif
+
t.commit ();
assert (*pb == b);
@@ -1690,6 +1743,16 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<ro_root> p_ro_r (db->load<ro_root> (ro_r.id));
+ unique_ptr<ro_root> p_rw_b (db->load<ro_root> (rw_b.id));
+ unique_ptr<ro_root> p_ro_d (db->load<ro_root> (ro_d.id));
+
+ unique_ptr<rw_root> p_rw_r (db->load<rw_root> (rw_r.id));
+ unique_ptr<rw_root> p_ro_b (db->load<rw_root> (ro_b.id));
+ unique_ptr<rw_root> p_rw_d (db->load<rw_root> (rw_d.id));
+#else
auto_ptr<ro_root> p_ro_r (db->load<ro_root> (ro_r.id));
auto_ptr<ro_root> p_rw_b (db->load<ro_root> (rw_b.id));
auto_ptr<ro_root> p_ro_d (db->load<ro_root> (ro_d.id));
@@ -1697,6 +1760,8 @@ main (int argc, char* argv[])
auto_ptr<rw_root> p_rw_r (db->load<rw_root> (rw_r.id));
auto_ptr<rw_root> p_ro_b (db->load<rw_root> (ro_b.id));
auto_ptr<rw_root> p_rw_d (db->load<rw_root> (rw_d.id));
+#endif
+
t.commit ();
assert (*p_ro_r == ro_r);
@@ -1730,8 +1795,14 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd (db->load<root> (d.id));
+#else
auto_ptr<root> pb (db->load<root> (b.id));
auto_ptr<root> pd (db->load<root> (d.id));
+#endif
t.commit ();
assert (*pb == b);
@@ -1754,8 +1825,14 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd (db->load<root> (d.id));
+#else
auto_ptr<root> pb (db->load<root> (b.id));
auto_ptr<root> pd (db->load<root> (d.id));
+#endif
t.commit ();
assert (*pb == b);
@@ -1790,8 +1867,14 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<base> pd (db->load<base> (d.id));
+#else
auto_ptr<base> pb (db->load<base> (b.id));
auto_ptr<base> pd (db->load<base> (d.id));
+#endif
t.commit ();
assert (*pb == b);
@@ -1823,8 +1906,15 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<base> pd (db->load<base> (d.id));
+#else
auto_ptr<base> pb (db->load<base> (b.id));
auto_ptr<base> pd (db->load<base> (d.id));
+#endif
+
t.commit ();
assert (*pb == b);
@@ -1885,8 +1975,15 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<root> pb (db->load<root> (id1));
+ unique_ptr<root> pd (db->load<root> (id2));
+#else
auto_ptr<root> pb (db->load<root> (id1));
auto_ptr<root> pd (db->load<root> (id2));
+#endif
+
t.commit ();
assert (*pb == b);
@@ -1922,10 +2019,18 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<root> pbr (db->load<root> (b.id));
+ unique_ptr<root> pdr (db->load<root> (d.id));
+ unique_ptr<base> pdb (db->load<base> (d.id));
+ unique_ptr<root> pb1r (db->load<root> (b1.id));
+#else
auto_ptr<root> pbr (db->load<root> (b.id));
auto_ptr<root> pdr (db->load<root> (d.id));
auto_ptr<base> pdb (db->load<base> (d.id));
auto_ptr<root> pb1r (db->load<root> (b1.id));
+#endif
t.commit ();
base& rb (static_cast<base&> (*pbr));
@@ -2044,7 +2149,12 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+
+#ifdef HAVE_CXX11
+ unique_ptr<base> pb (db->load<base> (d.id));
+#else
auto_ptr<base> pb (db->load<base> (d.id));
+#endif
t.commit ();
derived* pd (dynamic_cast<derived*> (pb.get ()));
diff --git a/common/inheritance/polymorphism/test5.hxx b/common/inheritance/polymorphism/test5.hxx
index e253f6a..78f909f 100644
--- a/common/inheritance/polymorphism/test5.hxx
+++ b/common/inheritance/polymorphism/test5.hxx
@@ -5,6 +5,8 @@
#ifndef TEST5_HXX
#define TEST5_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
#include <vector>
#include <memory>
@@ -17,7 +19,11 @@
#pragma db namespace table("t5_")
namespace test5
{
+#ifdef HAVE_CXX11
+ #pragma db object polymorphic optimistic pointer(std::unique_ptr)
+#else
#pragma db object polymorphic optimistic pointer(std::auto_ptr)
+#endif
struct root
{
virtual ~root () {}
diff --git a/common/inheritance/polymorphism/test6.hxx b/common/inheritance/polymorphism/test6.hxx
index 1682b3f..c12b5f4 100644
--- a/common/inheritance/polymorphism/test6.hxx
+++ b/common/inheritance/polymorphism/test6.hxx
@@ -5,6 +5,8 @@
#ifndef TEST6_HXX
#define TEST6_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
#include <memory>
@@ -16,7 +18,11 @@
#pragma db namespace table("t6_")
namespace test6
{
+#ifdef HAVE_CXX11
+ #pragma db object polymorphic pointer(std::unique_ptr)
+#else
#pragma db object polymorphic pointer(std::auto_ptr)
+#endif
struct root
{
virtual ~root () {}
@@ -55,7 +61,11 @@ namespace test6
unsigned long dnum;
std::string dstr;
+#ifdef HAVE_CXX11
+ std::unique_ptr<root> ptr;
+#else
std::auto_ptr<root> ptr;
+#endif
void
db_callback (odb::callback_event, odb::database&) const;
diff --git a/common/prepared/driver.cxx b/common/prepared/driver.cxx
index 0d30821..0467f70 100644
--- a/common/prepared/driver.cxx
+++ b/common/prepared/driver.cxx
@@ -33,13 +33,21 @@ query_factory (const char* name, connection& c)
{
typedef odb::query<person> query;
+#ifdef HAVE_CXX11
+ unique_ptr<params> p (new params);
+#else
auto_ptr<params> p (new params);
+#endif
prepared_query<person> pq (
c.prepare_query<person> (
name,
query::age > query::_ref (p->age) &&
query::name != query::_ref (p->name)));
+#ifdef HAVE_CXX11
+ c.cache_query (pq, move (p));
+#else
c.cache_query (pq, p);
+#endif
}
int
@@ -286,13 +294,13 @@ main (int argc, char* argv[])
{
typedef odb::query<person> query;
- auto_ptr<params> p (new params);
+ unique_ptr<params> p (new params);
prepared_query<person> pq (
c.prepare_query<person> (
name,
query::age > query::_ref (p->age) &&
query::name != query::_ref (p->name)));
- c.cache_query (pq, p);
+ c.cache_query (pq, move (p));
});
for (unsigned int i (1); i < 6; ++i)
diff --git a/common/query/basics/test.hxx b/common/query/basics/test.hxx
index 3e61c57..74b5ff5 100644
--- a/common/query/basics/test.hxx
+++ b/common/query/basics/test.hxx
@@ -5,6 +5,8 @@
#ifndef TEST_HXX
#define TEST_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
#include <vector>
#include <memory>
@@ -55,7 +57,11 @@ struct person
std::string first_name_;
#pragma db column ("middle") null
+#ifdef HAVE_CXX11
+ std::unique_ptr<std::string> middle_name_;
+#else
std::auto_ptr<std::string> middle_name_;
+#endif
#pragma db column ("last")
std::string last_name_;
diff --git a/common/readonly/test.hxx b/common/readonly/test.hxx
index 689b571..926b596 100644
--- a/common/readonly/test.hxx
+++ b/common/readonly/test.hxx
@@ -5,6 +5,8 @@
#ifndef TEST_HXX
#define TEST_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <vector>
#include <memory> // std::auto_ptr
@@ -203,10 +205,17 @@ struct wrapper
#pragma db id
unsigned long id;
+#ifdef HAVE_CXX11
+ std::unique_ptr<unsigned long> pl;
+ const std::unique_ptr<unsigned long> cpl;
+ std::unique_ptr<const unsigned long> pcl;
+ const std::unique_ptr<const unsigned long> cpcl;
+#else
std::auto_ptr<unsigned long> pl;
const std::auto_ptr<unsigned long> cpl;
std::auto_ptr<const unsigned long> pcl;
const std::auto_ptr<const unsigned long> cpcl;
+#endif
};
// Readonly object with auto id.
diff --git a/common/wrapper/test.hxx b/common/wrapper/test.hxx
index 9e3dc2b..36aec87 100644
--- a/common/wrapper/test.hxx
+++ b/common/wrapper/test.hxx
@@ -231,7 +231,11 @@ namespace test5
unsigned long id;
#pragma db null
+#ifdef HAVE_CXX11
+ std::unique_ptr<comp> p;
+#else
std::auto_ptr<comp> p;
+#endif
odb::nullable<comp> n;
diff --git a/evolution/soft-delete/model.hxx b/evolution/soft-delete/model.hxx
index 825f969..99bc664 100644
--- a/evolution/soft-delete/model.hxx
+++ b/evolution/soft-delete/model.hxx
@@ -6,8 +6,10 @@
# error model.hxx included directly
#endif
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <odb/core.hxx>
#include <odb/vector.hxx>
@@ -448,7 +450,11 @@ namespace MODEL_NAMESPACE(MODEL_VERSION)
#pragma db id
unsigned long id_;
+#ifdef HAVE_CXX11
+ std::unique_ptr<value> v;
+#else
std::auto_ptr<value> v;
+#endif
unsigned long num;
};
diff --git a/mssql/types/test.hxx b/mssql/types/test.hxx
index aea64cb..0519567 100644
--- a/mssql/types/test.hxx
+++ b/mssql/types/test.hxx
@@ -20,6 +20,8 @@ typedef struct _GUID
} GUID;
#endif
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
#include <vector>
#include <memory> // std::auto_ptr
@@ -321,7 +323,11 @@ struct long_null
unsigned int id_;
#pragma db type ("VARCHAR(max)") null
+#ifdef HAVE_CXX11
+ std::unique_ptr<std::string> str_;
+#else
std::auto_ptr<std::string> str_;
+#endif
bool
operator== (const long_null& y) const
diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx
index 8911635..6e13fcd 100644
--- a/oracle/types/driver.cxx
+++ b/oracle/types/driver.cxx
@@ -270,7 +270,11 @@ main (int argc, char* argv[])
//
{
db->persist (b3);
+#ifdef HAVE_CXX11
+ unique_ptr<descriptor> p (db->load<descriptor> (3));
+#else
auto_ptr<descriptor> p (db->load<descriptor> (3));
+#endif
assert (b3 == *p);
b3.blob.push_back (123);
db->update (b3);
diff --git a/oracle/types/test.hxx b/oracle/types/test.hxx
index 687f05e..2eaa6e5 100644
--- a/oracle/types/test.hxx
+++ b/oracle/types/test.hxx
@@ -5,6 +5,8 @@
#ifndef TEST_HXX
#define TEST_HXX
+#include <common/config.hxx> // HAVE_CXX11
+
#include <string>
#include <vector>
#include <memory> // std::auto_ptr
@@ -96,7 +98,12 @@ struct time_interval
int nanosecond;
};
+#ifdef HAVE_CXX11
+typedef std::unique_ptr<std::string> string_ptr;
+#else
typedef std::auto_ptr<std::string> string_ptr;
+#endif
+
typedef std::vector<std::string> strings;
#pragma db object
diff --git a/qt/common/containers/change-tracking/driver.cxx b/qt/common/containers/change-tracking/driver.cxx
index 644d100..c807c70 100644
--- a/qt/common/containers/change-tracking/driver.cxx
+++ b/qt/common/containers/change-tracking/driver.cxx
@@ -141,7 +141,11 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
+#ifdef HAVE_CXX11
+ unique_ptr<object> p (db->load<object> ("1"));
+#else
auto_ptr<object> p (db->load<object> ("1"));
+#endif
assert (p->s._tracking ());
t.commit ();
}
@@ -528,7 +532,13 @@ main (int argc, char* argv[])
// Armed copy.
//
{
+
+#ifdef HAVE_CXX11
+ unique_ptr<object> c;
+#else
auto_ptr<object> c;
+#endif
+
{
o.s.pop_back ();
@@ -595,7 +605,7 @@ main (int argc, char* argv[])
//
#ifdef HAVE_CXX11
{
- auto_ptr<object> c;
+ unique_ptr<object> c;
{
o.s.pop_back ();
diff --git a/qt/common/containers/change-tracking/test.hxx b/qt/common/containers/change-tracking/test.hxx
index c792b19..dcebf2e 100644
--- a/qt/common/containers/change-tracking/test.hxx
+++ b/qt/common/containers/change-tracking/test.hxx
@@ -18,7 +18,11 @@
#include <odb/core.hxx>
#include <odb/qt/list.hxx>
+#ifdef HAVE_CXX11
+#pragma db object pointer(std::unique_ptr)
+#else
#pragma db object pointer(std::auto_ptr)
+#endif
struct object
{
object () {}