Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] - Review by Neil Groves
From: Casey Carter (Casey_at_[hidden])
Date: 2011-10-18 13:28:29


On Tue, Oct 18, 2011 at 12:21, Vicente J. Botet Escriba <
vicente.botet_at_[hidden]> wrote:

> Le 18/10/11 17:07, Marshall Clow a écrit :
>
> On Oct 18, 2011, at 6:42 AM, Dave Abrahams wrote:
>>
>>> on Mon Oct 17 2011, Marshall Clow<mclow.lists-AT-gmail.com> wrote:
>>>
>>> [heading Exception Safety]
>>>>
>>>> All of the variants of `all_of` and `all_of_equal` take their
>>>> parameters by value or const reference, and do not depend upon any
>>>> global state. Therefore, all the routines in this file provide the
>>>> strong exception guarantee.
>>>>
>>> It may be true, but it's not an appropriate conclusion from the
>>> premises. std::copy also takes all its parameters by value.
>>>
>>
>> Good point - how would you state it, then?
>> "Only reads from the iterators" is the key point (unlike std::copy)
>>
>
> Maybe because these functions don't modify anything?
>
> Vicente
>
>
I think the appropriate wording is "All variants of 'all_of' and
'all_of_equal' have no side effects, and therefore provide the strong
exception guarantee."

The first-order predicate logic equivalence "( for_all_x p(x) ) == not (
for_some_x not p( x ) )" is a very good reason for 'all_of' and
'all_of_equal' to return true when given the empty set as input.

-- 
Casey Carter

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