aboutsummaryrefslogtreecommitdiff
path: root/common/const
diff options
context:
space:
mode:
Diffstat (limited to 'common/const')
-rw-r--r--common/const/driver.cxx14
-rw-r--r--common/const/test.hxx17
2 files changed, 11 insertions, 20 deletions
diff --git a/common/const/driver.cxx b/common/const/driver.cxx
index cc58cf8..e26fb3c 100644
--- a/common/const/driver.cxx
+++ b/common/const/driver.cxx
@@ -33,15 +33,15 @@ main (int argc, char* argv[])
aggr ca_ (2); // o1 and o2 are NULL
const aggr& ca (ca_);
- obj1_ptr o1 (new obj1 (1));
- obj1_ptr co1_ (new obj1 (2));
- obj1_cptr co1 (co1_);
+ obj1* o1 (new obj1 (1));
+ obj1* co1_ (new obj1 (2));
+ const obj1* co1 (co1_);
a.o1 = co1;
- obj2_ptr o2 (new obj2 (1));
+ auto_ptr<obj2> o2 (new obj2 (1));
obj2* co2_ (new obj2 (2));
a.o2.reset (co2_);
- obj2_cptr& co2 (a.o2);
+ auto_ptr<const obj2>& co2 (a.o2);
// persist via references
//
@@ -129,7 +129,7 @@ main (int argc, char* argv[])
{
// i->f (); // error
i->cf ();
- obj1_cptr p (i.load ());
+ const obj1* p (i.load ());
obj1 o (0);
i.load (o);
assert (p->id == o.id);
@@ -144,7 +144,7 @@ main (int argc, char* argv[])
{
// i->f (); // error
i->cf ();
- obj2_cptr p (i.load ());
+ auto_ptr<const obj2> p (i.load ());
obj2 o (0);
i.load (o);
assert (p->id == o.id);
diff --git a/common/const/test.hxx b/common/const/test.hxx
index 7e8a718..0164880 100644
--- a/common/const/test.hxx
+++ b/common/const/test.hxx
@@ -9,16 +9,7 @@
#include <memory>
#include <odb/core.hxx>
-struct obj1;
-struct obj2;
-
-typedef obj1* obj1_ptr;
-typedef const obj1* obj1_cptr;
-
-typedef std::auto_ptr<obj2> obj2_ptr;
-typedef std::auto_ptr<const obj2> obj2_cptr;
-
-#pragma db object pointer (obj1_ptr)
+#pragma db object pointer (obj1*)
struct obj1
{
obj1 () {}
@@ -31,7 +22,7 @@ struct obj1
void cf () const {}
};
-#pragma db object pointer (obj2_ptr)
+#pragma db object pointer (std::auto_ptr<obj2>)
struct obj2
{
obj2 () {}
@@ -54,8 +45,8 @@ struct aggr
#pragma db id
int id;
- obj1_cptr o1;
- obj2_cptr o2;
+ const obj1* o1;
+ std::auto_ptr<const obj2> o2;
};
#endif // TEST_HXX