Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] - Review by Neil Groves
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-10-01 13:26:48


On Sat, Oct 1, 2011 at 11:20 AM, Neil Groves <neil_at_[hidden]> wrote:
> Yes, I maintain Boost.Range hence my comments with respect to ranges are
> reasonably well informed. I have long been a fan of Design by Contract and
> hence I have experience using my own versions of the functions all_of etc.

Indeed N1962 uses a "contract helper" function all_equals (which
should ideally be accompanied by the assertion requirement
has_equal_to<T>::value so to not always require the vector's type T to
be EqualityComparable):

http://svn.boost.org/svn/boost/sandbox/contract/libs/contract/doc/html2/contract__/examples.html#contract__.examples.n1962_vector

boost::algorithm::all_of_equal (or all_equal_to, or whatever the final
named ends being) could be conveniently used here instead of
all_equals. The same applies to the contract of most (all?) other STL
containers.

--Lorenzo


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