mardi 25 juin 2019

class member shared between instance copies

I want to create a class with a member shared by some instances (by copies of the first instance), something like std::shared_ptr.

The member is small (int) so std::shared_ptr and memory allocation look as overkill.

Additional requirements are: it must be possible to work with raw value and address as with ordinal int.

Is this possible without std::shared_ptr?

Aucun commentaire:

Enregistrer un commentaire