Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-07 18:59:37


Thorsten Ottosen wrote:
>
> I am myself irritated by the need to say
>
> using namespace boost;
> some_range_fun( r );
>
> if nothing else, then because it is not super portable in itself.
>
> My suggestion have been to allow
>
> boost::some_range_fun(r);
>
> to support ADL via the requirement that users implement
>
> adl_some_range_fun(r);
>
> Can you confirm that this would remove the present problems with gcc?
>
> If so, I will propose this on the developer list and make it part of 1.33
>

I admit I've only skimmed the ongoing discussion, but something like
what you are suggesting here should work, I think. How about this:

namespace boost {

   namespace range_detail_ {

     template<typename T>
     typename range_iterator<T>::type boost_range_begin(T& t) {
       // ...
     }

     template<typename T>
     typename range_iterator<T>::type begin(T& t) {
       // this uses ADL
       return boost_range_begin(t)
     }

   } // namespace range_detail_

   using range_detail_::begin;

}

Recommended practice would be to always use qualified calls to
boost::begin, and then let users define overloads of boost_range_begin
in their own namespace and let ADL find it.

Does that satisfy everybody's concerns? (Probably not, but it couldn't
hurt to ask, right?)

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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