mardi 28 juillet 2015

shared_ptr with dynamic allocated memory and with mmap-ed memory

For my project I am using shared_ptr with dinamically allocated struct.

However at some point I am acessing same struct, but on mmap-ed memory.

Is there some trick I can use with shared_ptr, so not to duplicate existing code? For example custom deleter that actually do not delete?

I realize this will be risky, accessing mmap is generally risky - but it will be done for very short period of time - inside function body and I do not want to copy whole memory blob, just to run some simple function over the memory.

Aucun commentaire:

Enregistrer un commentaire