|
Boost : |
Subject: Re: [boost] Review Request: Creasing (Sequence Properties)
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-01-27 17:36:52
Joachim Faulhaber wrote:
> >
> > That's an excellent question. I, too, foresaw its
> > usefulness in assertions.
> > I can imagine those doing DBC would like it, too. However,
> > I can imagine
> > examining file, network, or user input to ensure the data
> > fits some ordering criteria, too.
>
> . . . more of the (initially) asserting-the-invariant type of use.
The latter were not, in my mind, assertion uses, but rather run-time, production code tests to determine whether to accept or reject an input.
> Yet, the question no longer is: Is "is_sorted" (aka
> is_ordered, is_creasing)
> an important predicate, that needs to be included into boost
> algorithms,
> because *it already is*. As Grant hinted there is boost::is_sorted in
> boost/detail/algorithm.hpp. Moreover std::is_sorted is in the sgi-stl
That's nearly the same as *not* being in Boost as its being in the detail directory implies that it is an unsupported implementation detail.
> and std::is_sorted will probably be in the new standard (see N3000):
> So is_creasing is ceasing I dare say.
The round number confused me when I saw it before and I didn't take the time to check on it. I now understand N3000 to be a reference to a standards process document, which means that only now do I understand that is_sorted is likely coming in C++1x.
Because folks will continue to use C++98/03 for some time, it is reasonable for Boost to provide a fallback for what's to come. Consequently, there's room yet to put this predicate into Boost.
> Remains the question, if the variants of
> is_[strictly_]{in_,de_}creasing
> are to be added as algorithms, which conjures up another intersting
> question:
>
> Are there criteria to be fulfilled to maintain the minimality
> of a set of free algorithms?
I understand the desire to keep the set small enough to be manageable, but it should be large enough to avoid the need to repeat (and rediscover) common recipes. Are those four predicates sufficiently useful to justify being documented, tested, and maintained in Boost? If not, they can be illustrated as examples for use of is_sorted.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk