# Boost :

Subject: Re: [boost] [Review:Algorithms] - Review by Neil Groves
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-10-18 13:59:02

Christopher Jefferson wrote:
> On 18 Oct 2011, at 18:02, Stewart, Robert wrote:
> > Marshall Clow wrote:
> >> On Oct 18, 2011, at 5:30 AM, Stewart, Robert wrote:
> >>> Marshall Clow wrote:
> >>>>
> >>>> * `all_of` and `all_of_equal` both return true for empty
> >>>> ranges, no matter what is passed to test against. When
> >>>> there are no items in the sequence to test, they all
> >>>> satisfy the condition to be tested against.
> >>>
> >>>
> >>> All variants of `all_of` and `all_of_equal` always return
> >>> true for empty ranges.
> >>
> >> This is a case where a bit of rationale adds to the
> >> explanation, I think.
> >
> > No matter how you try to rationalize the result, the other
> > could be justified equally. That is, since there are no
> > elements, none satisfied the criteria, so return false.
> > Returning true or false for empty ranges is determined by
> > fiat.
>
> No, I agree with the justification. Almost all of mathematics
> relies on a basis which requires "forall i in S. p(i)" is true
> when S is empty, and "exists i in S. p(i)" is false when S is
> empty.
>
> There are lots of conditions people expect to hold like:
>
> If T is a subset of S, then "forall i in S.p(i)" implies
> "forall i in T.p(i)".
>
> Which would be violated with forall wasn't always true for an
> empty set (or in our case, empty range).

Marshall's rationale wasn't based upon mathematics. Your statements may well be sufficient to justify the choice, which removes it from the realm of fiat, but what Marshall wrote added no clarity. I didn't argue for returning false; I just noted that the rationale didn't justify the choice. I'm not convinced that any rationale is needed.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.