Settings

Theme

Can you change state in a const function in C++? Why? How?

bytesandlogs.me

3 points by itskarad 2 years ago · 1 comment

Reader

Someone 2 years ago

The author hacks it in using const_cast (https://en.cppreference.com/w/cpp/language/const_cast), but doesn’t seem to know mutable (https://en.cppreference.com/w/cpp/language/cv#mutable) exists for this purpose.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection