Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-09-15 07:48:00


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

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

> > then what about the following:
> >
> > Returns:
> >
> > x.first if x is an std::pair
> > x if x is an array
> > range_begin(x) if range_begin() can be found by ADL
> > x.begin() otherwise
> >
> > ?
>
> that would be an improvement. I think you need "otherwise," at the
> beginning of all lines of the 2nd column but the first.

like so

x.first if x is an std::pair, otherwise
x if x is an array, otherwise
range_begin(x) if range_begin() can be found by ADL, otherwise
x.begin()
 
?

I personally think having one "otherwise" is ok. lot's of math do it like that.

> Nitpicking,
>
> range_begin(x) if range_begin() can be found by ADL
>
> is not quite right. I think it's more like
>
> range_begin(x) if range_begin(x) is well-formed in an arbitrary
> namespace.
>
> but I'm not certain I have that right either.

hm...what about

  if range_begin() can be found in namespaces associated with
  x.

OTOH, isn't that just ADL?

> Are you really
> detecting whether range_begin can be found via ADL?

No.

> I wrote code to
> do that trick, but I don't remember seeing it in the range lib.

Cool trick, though.

The suggested spec. says that the return-type depends on 4 cases, it
doesn't state how these cases are implemented. I don't think they need
to state that.

-Thorsten


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