[odb-users] Compilation error when calling QLazyWeakPointer<T>::load()

Boris Kolpackov boris at codesynthesis.com
Tue Feb 21 11:49:22 EST 2017


Hi Gilles,

Gilles Bene <gilles.benepougoue at gmail.com> writes:

> /usr/include/odb/qt/smart-ptr/lazy-ptr.ixx:473:7: error: no match for
> 'operator=' (operand types are 'QSharedPointer<Sortie>' and
> 'odb::object_traits<Sortie>::pointer_type {aka Sortie*}')
>      r = i_.template load<T> (false); // Keep id.
>        ^

Well, the compiler tells you exactly what the problem is: load() returns
Sortie* and left-hand-side is QSharedPointer<Sortie>. And that assignment
is not valid. Which one would be valid? For example, QSharedPointer<Sortie>
to QSharedPointer<Sortie>. Why is load() returning Sortie* instead of
QSharedPointer<Sortie>? Because you haven't told ODB that your object
pointers should be something other than raw pointers (see Section 3.3,
"Object and View Pointers" in the manual).

Boris




More information about the odb-users mailing list