On Thursday 19 February 2015 17:32:11 Daniel Teske wrote: > On Thursday 19 Feb 2015 08:26:29 Thiago Macieira wrote: > > On Thursday 19 February 2015 13:29:48 Daniel Teske wrote: > > > [1] ranged based for uses std::begin(container), which if not overloaded > > > calls container.begin(), which detaches. > > > > > > So using range-based can be used: > > > - If the container is const or > > > - If the container is unshared or > > > - To actually change the container's contents > > > > Sounds like the intended behaviour to me. What's wrong with this picture? > > You don't want to detach if you are only reading.
Then make your container const. A cast or template function call that adds const is very easy. The design for the range-based for is that it can be used to mutate the container, so the above picture is exactly what is intended for that construct. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
