[odb-users] ODB 2.5.0-b.19 self-referential attribute mapping
error
Boris Kolpackov
boris at codesynthesis.com
Mon Sep 28 07:43:14 EDT 2020
Craig Burton <rccraigb at gmail.com> writes:
> #include <odb/core.hxx>
> #include <boost/shared_ptr.hpp>
> #include <boost/weak_ptr.hpp>
>
> #pragma db object table ("Node")
> class Node
> {
> protected:
> friend class odb::access;
> #pragma db id auto
> unsigned long id_;
>
> private:
> boost::shared_ptr<Node> _above;
>
> #pragma db value_not_null inverse(_above)
> std::vector<boost::weak_ptr<Node> > _below;
> };
>
> /usr/local/odb-2.5.0/bin/odb \
> --database mysql \
> --std c++11 \
> --generate-schema \
> --generate-query \
> --profile boost/date-time \
> --generate-session \
> --at-once \
> --input-name Depot \
> -I/home/cburton/Development/odb-2.5-runtime/odb/include \
> -I/usr/local/boost_1_62_0 Node.h
I am pretty sure you need to enable the boot/smart-ptr profile (which
includes traits for boost::*_ptr and makes boost::shared_ptr the default
object pointer).
More information about the odb-users
mailing list