lundi 29 mai 2017

atomic_store of shared_ptr of interface

I am trying to set the value of a shared_ptr in an atomic way:

shared_ptr<Base> a = std::make_shared<Derived>();
....
shared_ptr<Base> b;
std::atomic_store(&b,a); // Error here

I got the error message "'std::shared_ptr< Base >' is not derived from 'volatile std::atomic<_ITp>'"

How to fix this? Thanks.

Aucun commentaire:

Enregistrer un commentaire