I need to make my class smart enough to provide such functionality.
This is counter intuitive in C++ and might lead to mistakes and confusion, but if you really want it, just implement data sharing class without copy-on-write mechanism (AFAIR it's called a single state class).
Bookmarks