20-Sep-2013 14:00, Jacob Carlborg пишет:
On 2013-09-20 11:37, Szymon Gatner wrote:

If only std algorithms took containers (by that I mean things that
container for accepts too) as arguments (and not iterators)... even in
the form of new functions like foreach_all, transform_all etc.

Can't a container be a range as well?


For Christ sake no, no and no. For starters range skips/drops elements when iterating, and thusly iteration has its own state that is useless for a container otherwise.

The idea of "contange" spreads like virus, no matter how abominable the end result is. The fact that slices sometimes look like containers (BTW ill-suited for anything beyond primitives/PODish stuff ) must be the corner stone of this belief. Strengthened on the motto of trying to make user defined types to mimic behavior of built-ins it leads to a school of thought that it's fine to blend ownership and access.

TL;DR: Suboptimal, unnatural and error prone are keywords.

--
Dmitry Olshansky

Reply via email to