Smart Pointer release() const : it can set the pointer to null with the keyword "const"?

C

coala

In Smart Pointer class, we have a piece of code:

inline void release(void) const { if (mPtr) mPtr->release(); mPtr = 0;
}

It can set mPtr but it is still const?

Why could this work and why it can be compiled? We have used it for
years.

Thanks.

- C.
 
V

Victor Bazarov

coala said:
In Smart Pointer class, we have a piece of code:
[..]

You already asked that, three hours ago. Is there something you
didn't understand in the answers given? Do you not know how to
see the responses you've got so far? (if so, fat chance getting
this this question to be answered...)

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top