[odb-users] Find the bug under odb::lazy_shared_ptr source code

Boris Kolpackov boris at codesynthesis.com
Mon May 22 10:23:06 EDT 2023


陈焕鑫 <202121046942 at mail.scut.edu.cn> writes:

> /usr/include/odb/lazy-ptr.ixx:1153:10: error: no match for ‘operator=’ (operand types are ‘std::shared_ptr<Article>’ and ‘odb::object_traits<Article>::pointer_type’ {aka ‘Article*’})
>  1153 |       p_ = i_.template load<T> (true); // Reset id.
>
> 
> It seems that you  cannot assign a rawpointer directly to a shared pointer

No you can't, and it's a good thing. To use an odb::lazy_shared_ptr your
object must use std::shared_ptr as an object pointer. For details, see:

https://www.codesynthesis.com/products/odb/doc/manual.xhtml#3.3



More information about the odb-users mailing list