
"David Abrahams" <dave@boost-consulting.com> wrote in message news:u3c1jhvz5.fsf@boost-consulting.com...
"Jonathan Turkanis" <technews@kangaroologic.com> writes:
template<typename Range> typename range_const_iterator<X>::type const_begin(Range& rng) { return begin(static_cast<const Range&>(rng)); }
For one thing you can't use static_cast to change constness.
Are you sure? The expression const Range& r(rng) is well formed, I believe, so static_cast<const Range&>(rng) should be okay.
I can't imagine why you'd want this first overload.
You're right that it's superflous, given the second overload. But you should still be able to imagine why I wrote it. ;-) I forgot that X::iterator must be convertible to X::const_iterator, and that you can take advantage of more implicit conversions when you switch from member functions to non-member functions. Jonathan