Instead of using try/catch blocks everytime I need to construct any objects after allocating a block of memory for them with an allocator I use internally in my container, I would like to use a class derived from std::auto_ptr (I have no c++11 here) with an overridden destructor, so that it could deallocate the pointed memory and release the pointer afterwards. Are there any disadvantages in doing this?
Instead of using try/catch blocks everytime I need to construct any objects after allocating
Share
If you don’t mind using
boostandboost::shared_ptr<>, you can provide a customdeleter. See the top 2 answers to this question.