[odb-users] Passing persistence object to smart pointer
Bright Dadson
losintikfos at yahoo.co.uk
Thu Feb 24 06:16:18 EST 2011
Hi Guys,
I was wondering if it is possible to pass persistence object person as used in
the demo to auto_ptr?
I tried auto_ptr<person> joan(new person());
and got below exception which I immediately thought I am violating the usage of
my persistence object.
But having still thought of this - I was wondering if it is possible to pass
ownership to smart pointers without
below exception been spat.
Exception:
usr/local/include/odb/database.ixx: In person function ‘typename
odb::object_traits<T>::id_type odb::database::persist(const P<T>&) [with T =
person, P = std::auto_ptr]’:
In file included from /usr/local/include/odb/database.hxx:184,
/usr/local/include/odb/database.ixx:50: instantiated from ‘typename
odb::object_traits<T>::id_type odb::database::persist(P<T>&) [with T = person, P
= std::auto_ptr]’
driver.cpp:48: instantiated from here
/usr/local/include/odb/database.ixx:40: error: invalid initialization of
reference of type ‘person* const&’ from expression of type ‘const
std::auto_ptr<person>’
make: *** [build/Debug/GNU-Linux-x86/driver.o] Error 1
More information about the odb-users
mailing list