Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-09-14 15:26:32


Thorsten Ottosen <nesotto_at_[hidden]> writes:

> David Abrahams <dave <at> boost-consulting.com> writes:
>
>>
>> Thorsten Ottosen <nesotto <at> cs.aau.dk> writes:
>
>> > The reference docs state exactly what the functions returns.
>>
>> Yes, but the presentation is unprecedented. It's also a bit
>> confusing, because until you understand how to read the tables, each
>> function appears to have multiple return values.
>
> 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.

It's not clear to me that this is better than expressing range_begin
as three separate overloads (I don't think it matters whether you
actually implement it that way), but it works in principle.

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. Are you really
detecting whether range_begin can be found via ADL? I wrote code to
do that trick, but I don't remember seeing it in the range lib.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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