[odb-users] How to use the lazy_weak_ptr?
黄奕
ruffian_hy at 126.com
Fri Nov 15 21:34:24 EST 2019
At 2019-11-16 10:22:36, "黄奕" <ruffian_hy at 126.com> wrote:
I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of “error: object data member ‘ m_a' specified in db pragma column is inverse”.
BTW, m_a also belong to a view join by this two class
class C { public: ... int64_t a; ... }; #pragma db view(C) pointer(std::shared_ptr) object(B) object(A: B::m_a == A::m_id) #pragma db member(C::a) column(B::m_a)
At 2019-11-16 02:52:50, "Boris Kolpackov" <boris at codesynthesis.com> wrote:
>黄奕 <ruffian_hy at 126.com> writes:
>
>> class B
>> {
>> ...
>> private:
>> #pragma db inverse(m_b)
>>
>> odb::lazy_weak_ptr<A> m_a;
>> ...
>> };
>> #pragma db object(B) pointer(std::shared_ptr)
>> #pragma db member(m_a)
>>
>> But I get the error of “error: object data member ‘ m_a' specified in db pragma column is inverse”.
>
>Try to move inverse to the member(m_a) pragma:
>
>#pragma db member(m_a) inverse(m_b)
>
>Also, dealing with circular relationship is tricky, especially when
>spread over multiple headers; see "Circular Relationships" in the
>manual for details:
>
>https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3
More information about the odb-users
mailing list