Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-03 11:23:01


Thorsten Ottosen <nesotto_at_[hidden]> writes:

> | "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
> |
> | > "David Abrahams" <dave_at_[hidden]> wrote in message news:ur7pkurnp.fsf_at_boost-consulting.com...
>
> [snip, adl_begin()]
>
> | > apart from the adl stuff, it already is like that. Did you mean to
> | > put in the range namespace to avoid problems with classes in boost?
> |
> | No, I mean so that the concept can be described in terms of
> | boost::range and Collection can become a refinement of Range.
>
> I see.
>
> | > | Then you change the Range concept to require that
> | > | boost::range::begin(col) works.
> | >
> | > hm...yeah...one could perhaps state both syntaxes as part of the concept, eg
> | >
> | > Valid expressions
> | > ============
> | > begin( a )
> | > or
> | > a.begin()
> |
> | No, you have to say boost::range::begin(col). Otherwise they could
> | make a.begin() valid but begin(a) invalid, and that would break
> | boost::range::begin.
>
> I don't like this circular dependency on the concepts: Range has a special meaning
> if the argument is a Collection

?? special meaning ??

> , yet Collection is supposed to refine Range.
>
> | > perhaps the Range concept could specify
> | >
> | > Primary Template Behavior
> | > ==================
> | > return a.begin()
> | >
> | > ?
> |
> | Wha???
> |
> | What do primary templates have to do with this?
>
> it is the behavior of the primary template that makes coillections act as Ranges.

What primary template?

> | > And maybe we don't have to talk about collection as a refinement;
> | > maybe a new term is in order, like "act", sa in "all Collections may
> | > act as Ranges".
> |
> | ... provided that "..."
> |
> | Or, we could say that certain refinements of Collection are also
> | refinements of Range.
>
> hm...it doesn't sound right, does it?

No, it's not something we'd need to say.

> boost\libs\range\doc\external_concepts.html
>
> described the idea of external and internal versions of concept, roughly correponding to
> whether functions are free-standing or members.

Eeew!

> In that terminology, we could say
>
> 1. Collection would be a refinement of InternalRange
> 2. ExternalRange will, by definition, work with all corresponding InternalRange

Except that if it relies on ADL, it's not "by definition" because an
unrelated begin() with the wrong semantics could be defined.

-- 
Dave Abrahams
Boost Consulting
http://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