You're just reinventing smart pointers that have existed for yonks. Read up on how to use Boost smart pointers. In fact, reserve a few days just to get an idea of what you can achieve with Boost, it's a huge library.
Wishing without work is like fishing without bait. -- Frank Tyger