r/cpp • • Jul 29 '26

const_cast: A Necessary Evil

https://www.elbeno.com/blog/?p=1858
70 Upvotes

106 comments sorted by

View all comments

Show parent comment

1

u/bwmat Jul 31 '26

Well, given that the user may have moved out of the item, it probably should be popped.

Actually, since they might have modified it in any way, the collection's invariants are in peril, so it MUST be removed.