Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-10-15 16:47:06


On Tuesday 15 October 2002 04:38 pm, Craig Henderson wrote:
> "v m" <boost_vam_at_[hidden]> wrote in message
> > 3. There are several differences between the standard
> > and the current archetype classes, especially the
> > iterator archetype classes. For example, almost all
> > the relational operators (operator==, operator!= etc)
> > have a return type of bool whereas the standard
> > requires a return type convertible to bool. Would
> > changing the return type have any unwanted
> > consequences (not particularly in the
> > concept_archetype.hpp) ?
>
> How is this not conforming to the standard? The return type is bool. The
> standard requires a return type that is convertible to bool (Table 72).
> bool is implicitly convertible to bool. What's the problem?
> The synopsis of the iterator class in 24.2 itself defines the return type
> as bool.

It's conforming, but it's not the best possible archetype. Concept archetypes
should push the requirements as far as possible. So the relational operators
for the archetype should each return a unique type that is implicitly
convertible to 'bool' (thus making sure that no code assumes that the return
type is exactly 'bool').

        Doug


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