I want to use C++11 smart pointers always, with traditional pointer syntax (which a little similar to Java syntax) , because I don't want to worry about memory management , I think it's good idea to overload new operator with custom one, in other words
Instead of create new object dynamically like this :
obj *o = new obj();
which create traditional pointer to obj, I want to make it create smart pointer , like this
obj *o = new obj(); // o will be deleted automatically
How do I make something like this ?
Note : I don't want to replace the original new operator ,I just want to overload my own class one.
Thanks .
Aucun commentaire:
Enregistrer un commentaire