How does delete deal with pointer constness?

前端 未结 5 2027
不知归路
不知归路 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:13

    delete is an operator that you can overload. It takes a pointer as an argument, and frees the memory, possibly using free. The compiler allows this whether the pointer is const or not.

提交回复
热议问题