Boost logo

Boost Users :

Subject: Re: [Boost-users] implementing a new Range
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-26 18:31:51


AMDG

Mathias Gaunard wrote:
> namespace boost
> {
> namespace range_detail
> {
> template<typename T>
> ... begin(const T& t) { return t.begin(); }
> }
>
> template<typename T>
> ... begin(const T& t)
> {
> using range_detail::begin;
> return begin(t);
> }
>
> }
>
> (Needs to replace ... with range_iterator<T> variants, add non-const
> overloads, handle the old range_begin customization point)
> I don't see how that kind of thing can cause infinite recursion. If
> there is no overload of begin picked up by ADL, it uses
> range_detail::begin.

I see. I forgot about the default implementation. The problem
with this scheme is that if boost is an associated namespace of
T, then boost::begin will be ambiguous with boost::range_detail::begin.
The workaround used by boost::swap doesn't work in this case.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net