Boost logo

Boost Users :

Subject: Re: [Boost-users] implementing a new Range
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-08-27 05:07:22


Steven Watanabe skrev:
> 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.

I had kind of hoped that we could do the same thing as boost.swap. If
not, that is really bad news.

-Thorsten


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