Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-09-15 11:33:04


David Abrahams <dave <at> boost-consulting.com> writes:

>
> Thorsten Ottosen <nesotto <at> cs.aau.dk> writes:

> > hm...what about
> >
> > if range_begin() can be found in namespaces associated with
> > x.
>
> Not quite right, because range_begin() denotes a function taking no
> arguments. You really should say
>
> range_begin(x)
>
> because it's an expression; it accounts for default arguments,

right, this is true.

> function templates,

specializations are found too, but we don't document what to specialize
(eg. boost::range_detail::range_begin())

> derived->base conversions, etc.

these won't happen as the default implementation
is the one in namespace boost::range_detail
which is a function template.

> > OTOH, isn't that just ADL?
>
> Yes, but the way you described it is just not correct; that's all.
> Oh, and I suppose an overload of range_begin in the global namespace
> would be found, provided it was declared before its point of use.

no, it wouldn't: the global namespace is never searched and
the default is chosen then, so a bit
 the same reason that a base class version won't work either.
(arguably the base class version should be found, but that's a different
story)

> That's why something like
>
> range_begin(x) if range_begin(x) is well-formed
>
> is more accurate.

I thinks ADL is the only mechanism that will valid here.

So with the change

  if range_begin(x) can be found by ADL

I think we nailed it. This should implicitly account for default
arguments, but I don't think we need to mention that.

As a related issue, how was everyone feeling about range_begin()
instead of boost_range_begin()?

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk