On 3/2/11 11:40 AM, Trass3r wrote:
I just can't imagine why in should be faster than const ref.

The use of ref introduces a level of indirection. I suspect the writer was trying to avoid copying array elements -- unnecessary, since vector_t was defined as a dynamic array, where only the bounds are passed. With ref, every access to a vector_t object involves a pointer dereference. Take out the ref, and const should behave identically to in. (It had better -- in and const are synonyms!)

Reply via email to