[odb-users] Passing persistence object to smart pointer

Bright Dadson losintikfos at yahoo.co.uk
Wed Mar 2 12:27:36 EST 2011


I have compiled my person.h file successfully with --default-pointer std::tr1::shared_ptr option.

Now when I attempt to build the project, I end up with below exception:

g++    -c -MMD -MP -MF build/Debug/GNU-Linux-x86/_ext/1294481841/person-odb.o.d -o build/Debug/GNU-Linux-x86/_ext/1294481841/person-odb.o /root/Documents/project/test/person-odb.cxx
                 from /root/Documents/project/test/person-odb.cxx:12:
In file included from /root/Documents/project/test/person-odb.hxx:29,
/usr/local/include/odb/tr1/pointer-traits.hxx:23: error: ‘tr1’ is not a member of ‘std’
/usr/local/include/odb/tr1/pointer-traits.hxx:23: error: ‘tr1’ is not a member of ‘std’
/usr/local/include/odb/tr1/pointer-traits.hxx:23: error: template argument 1 is invalid
/usr/local/include/odb/tr1/pointer-traits.hxx:69: error: ‘tr1’ is not a member of ‘std’
/usr/local/include/odb/tr1/pointer-traits.hxx:69: error: ‘tr1’ is not a member of ‘std’
/usr/local/include/odb/tr1/pointer-traits.hxx:69: error: template argument 1 is invalid


Do anyone know what I might be doing wrong?


--- On Wed, 2/3/11, Bright Dadson <losintikfos at yahoo.co.uk> wrote:

Thanks Boris!
Will remember to CC'ed odb-users mailing next time - It did escaped me!

B


--- On Wed, 2/3/11, Boris Kolpackov <boris at codesynthesis.com> wrote:

Hi,

In the future please keep your replies CC'ed to the odb-users mailing
list as discussed in the posting guidelines:

http://www.codesynthesis.com/support/posting-guidelines.xhtml


Bright Dadson <losintikfos at yahoo.co.uk> writes:

> Is it possible to use boost::shared_ptr instead of std::auto_ptr as
> the
 --default-pointer defintion for odb? if so, how do I pass 
> boost::shared_ptr as param to the odb codegen.

Not at the moment, but we are working on the ODB profile for Boost
which will allow this quite easily. We plan to release this in the
next week or two.

In the meantime, you can use std::tr1::shared_ptr (which has the
Boost shared_ptr interface). To do this, simply add the following
option to the ODB command line:

--default-pointer std::tr1::shared_ptr

And use std::tr1::shared_ptr instead of boost::shared_ptr in your
code.

Boris





      


      


More information about the odb-users mailing list