vendredi 19 août 2016

Casting std::shared_ptr

A library requires binary data to be shared as void *. The data to be shared is available as shared_ptr<T>.

Is there a way to cast shared_ptr<T> to void * ?

PS: Static casting does not work:

error: invalid static_cast from type ‘std::shared_ptr<DataPacket>’ to type ‘void*’ static_cast<void *>(binData);

Aucun commentaire:

Enregistrer un commentaire