http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49022
--- Comment #25 from Gabriel Dos Reis <gdr at gcc dot gnu.org> 2011-06-14 14:01:30 UTC --- (In reply to comment #23) > Ok, now I see, it's the operator[] of _BinBase which returns by value, I > overlooked that. Yes, "val" in "valarray" stands for "value", e.g. a valarray is a fundamentally a value, from a conceptual point of view; not an object. Range-based "for" is fundamentally container-oriented in the sense that it assumes that the container is an *object* that resides in memory, and the iteration really visits each cell in that object. A valarray is a *value*, and each individual value in that array may be produced by any mean, e.g. surrogates.