lundi 6 janvier 2020

how to use reset with const shared pointer to non const object?

I am trying to reset shared pointer which is member of struct coming from iterator of container with constant structs"elements".
the code does not compile, with error:

cannot convert 'this' pointer from 'const boost::shared_ptr<boost::log::v2s_mt_nt6::sinks::text_file_backend>' to 'boost::shared_ptr<boost::log::v2s_mt_nt6::sinks::text_file_backend> &'

this error tells me that const shared pointer is not allowed to be used by reset??!! is this true?
if so how can i cast this const shared pointer into non const to be used by reset??

Aucun commentaire:

Enregistrer un commentaire