This question refers to:
When should I use the new ranged-for and can I combine it with the new cbegin/cend?
Based on that question, to force the use of cbegin()
and cend()
, one needs to do, for example:
for (auto& v: const_cast<decltype(container) const>(container))
That's a lot of boilerplate code for a construct that was supposed to eliminate it. Is there some more compact way to do it? The reason for my question is, that an implicitly shared container might take my use of begin()
as a clue to detach itself.