Boost logo

Boost :

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

On Wednesday 16 October 2002 01:52 pm, Victor A. Wagner, Jr. wrote:
> At Tuesday 2002/10/15 14:47, you wrote:
> >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').
> My initial reaction was to simply reply "Are you on drugs?"
> On second thought, maybe I should just ask you for some of whatever you're
> smoking.
> I see no point in intentionally obfuscating (look it up) some things which
> are meant to be used as tools.

I would first suggest reading the description of concept archetypes, to make
sure you understand their purpose:

Is the following code correct w.r.t. the EqualityComparable concept?

  struct MyBoolean { MyBoolean(bool value); };

  template<typename EqualityComparable>
  void foo(const EqualityComparable& x, const EqualityComparable& y)
    MyBoolean b = (x == y);

Answer: no, and that's why the EqualityComparable concept archetype should
_not_ return just 'bool', because this error would go unnoticed. I'm glad
that someone is revisiting the concept archetypes, because there are yet more
subtle errors (this one from the Comeau standard library, libcomo) that
aren't caught by the concept checks library:

  template <class _InputIter, class _Predicate>
  inline _InputIter find_if(_InputIter __first, _InputIter __last,
                            _Predicate __pred,
    while (__first != __last && !__pred(*__first))
    return __first;


Boost list run by bdawes at, gregod at, cpdaniel at, john at