
On Dec 5, 2011, at 1:40 PM, Jeffrey Lee Hellrung, Jr. wrote:
On Mon, Dec 5, 2011 at 1:11 PM, Marshall Clow <mclow.lists@gmail.com> wrote:
On Dec 5, 2011, at 12:53 PM, Marshall Clow wrote:
But if I add the following code:
bool comp ( int x ) { return x > 10; } and res = Foo ( v, comp );
I get a bunch of compilation errors.
My bad. Since the range-based versions of Foo take the range by const &, they return pairs of const_iterators. res is a pair of non-const iterators; you can't assign one to the other.
...which suggests (to me) that you *may* want to provide a reference-to-non-const overload of Foo *even if* Foo does not modify its argument, since this will make it easier to mutate based on the result of Foo (if, e.g., the result is an iterator or pair of iterators).
Yes. I had come to that conclusion already. I would like Foo ( v.begin (), v.end ()); and Foo ( v ); to return the same results (or, at least, compatible results). -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki