
20 Sep
2004
20 Sep
'04
3:50 p.m.
Richard Hadsell wrote:
For clarity -- to tell the reader that you intended to modify the const-ness.
If I see const_cast, I usually expect it to cast away const-ness, not add it. In my opinion, using a cast to add const is really a pretty unusual thing to do so 'as_const' might be the clearest way of showing your intent. Of course, it requires the reader to know what it means. Daniel