Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Performance:
- An additional instruction could slow down the delete performance.
- 2. Could it be because of const pointers.
- Then again standard could have done something for this special case I guess.
- template<typename T>
- void deleten(T *&ptr) {
- delete ptr;
- ptr = NULL;
- }
- T* const foo = new T;
- delete foo;
- int *foo = new int;
- int *bar = foo;
- delete foo;
Add Comment
Please, Sign In to add comment