How does delete deal with pointer constness?

前端 未结 5 2001
不知归路
不知归路 2021-01-18 00:30

I was reading this question Deleting a const pointer and wanted to know more about delete behavior. Now, as per my understanding:

delete expressio

5条回答
  •  不要未来只要你来
    2021-01-18 01:06

    delete just makes a call to deallocate the memory the pointer points to, it doesn't change the value of the pointer nor the object. Therefore, delete has nothing to do with the const-ness of the pointer or object pointed to.

提交回复
热议问题