overloading operator delete, or how to kill a cat?

前端 未结 5 780
时光说笑
时光说笑 2021-01-19 15:15

I am experimenting with overloading operator delete, so that I can return a plain pointer to those who don\'t wish to work with smart pointers, and yet be able to control wh

5条回答
  •  [愿得一人]
    2021-01-19 15:57

    The destructor isn't responsible for freeing the memory and u've not prevented this from happening.

    The first call is freeing the memory, the second call goes bang.

提交回复
热议问题