Guest User

Untitled

a guest
Jun 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. 1. Performance:
  2. An additional instruction could slow down the delete performance.
  3.  
  4. 2. Could it be because of const pointers.
  5. Then again standard could have done something for this special case I guess.
  6.  
  7. template<typename T>
  8. void deleten(T *&ptr) {
  9. delete ptr;
  10. ptr = NULL;
  11. }
  12.  
  13. T* const foo = new T;
  14. delete foo;
  15.  
  16. int *foo = new int;
  17. int *bar = foo;
  18. delete foo;
Add Comment
Please, Sign In to add comment