Subject: Re: [boost] Review Request: Creasing (Sequence Properties)
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-01-27 14:35:22
Simonson, Lucanus J wrote:
> Joachim Faulhaber wrote:
> > 2010/1/24 Grant Erickson <gerickson_at_[hidden]>:
> >> The creasing algorithm templates define four template functions for
> >> determining the order properties of sequences, specifically:
> >> * Increasing
> >> * Decreasing
> >> * Strictly Increasing
> >> * Strictly Decreasing
> > I'd suggest to implement only the latter. This would make your
> > extension both more minimal and more general.
> I'm a little confused why there is such a narrow focus on
> ordering relationships here. What seems to be the most
Why is it confusing? The OP focused the thread and no one generalized it beyond the is_ordered idea.
> general solution to this is a generic range adaptor that
> given a range over elements of type T returns an adapted
> range over pairs of elements of type T that are adjacent to
> eachother in the input range. I'm constantly writing such
> adaptors to convert polygon vertices to polygon edges as
> pairs of vertices. Combine that with a foreach or just a
> while loop and you can apply the predicate. We can
You say that like there's no code involved.
> generalize the adjacent-pair-range-adaptor seperately from
> the foreach-element-in-a-range-apply-functor algorithm.
OK. Doing that doesn't preclude handy tools like is_ordered, however.
> As it happens we
> have boost libraries that provide a basis for each of these
> generally useful constructs. It seems a little pointless to
> propose a library to combine them to solve a very specific
> problem. Nobody is at a loss as to how to code up something
> to figure out whether elements in an iterator range are
> sorted, and nobody would or even should look in boost for
> such a simple thing.
If you say so. I don't happen to agree. Unless one does such a thing with any regularity, one must find a recipe or reinvent it again each time. Your statement seems rather like suggesting that std::for_each shouldn't be in the Standard Library because "nobody is at a loss as to how to code up something" to do such a loop.
> Did the author skip the determining
> interest step and ask for a review prematurely, or am I
> missing something about the proposed library?
Any time a library can provide a useful, robust, *named* solution to a common problem, it seems worthwhile. As could be seen from this thread, using std::adjacent_find was not immediately obvious, so there is room to write less than optimal solutions, making a Boost library solution helpful. Furthermore, if there are any compiler-specific quirks that should arise, the library can account for those and user code need not do so.
Have I missed something in your concern? Do you still disagree with including such tools in Boost, possibly in addition to your generalization?
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.