Boost logo

Boost Users :

Subject: Re: [Boost-users] Review of Interval Template Library (ITL) for inclusion
From: Jerry Jeremiah (jerry.jeremiah_at_[hidden])
Date: 2010-03-15 23:45:54


Joachim Faulhaber <afojgo <at> googlemail.com> writes:

>
> Hi Jerry,
>
> ...
>
> > In the Party example a boost::itl::set<string> is used to store the names
> > of the guests because it supports += as set union.  In that example you can
> > just as easily use:  struct GuestSetT : public std::set<string> {
> > std::set<string> & operator += (const std::set<string> & right) {
> > insert(right.begin(), right.end()); return *this; }}; My question is, does
> > this example really benefit from using itl::set?   I do see value in
> > itl::set and itl::map on their own but except this one use there aren’t any
> > examples that show why they would suit a particular application.
>
> In the ITL not only operator += but also -= and &= are "pervasive" and
> they are expected as defaults for interval maps in order to perform
> "aggregate on onverlap", where the operator is passed to combine
> associated values in case of overlap of intervals. One of the reasons
> to introduce itl::set and itl::map was to support these operators, so
> that interval maps of sets or even interval maps of maps of ... work
> "out of the box" without the need for the user to write adapter code
> (like the one proposed above).
>
> Other reviewers have criticised these "element containers" of the ITL
> as well. I am going to consinder their arguments in a redesign of the
> ITL's interface. One possibility that I will most likely provide is
> adaptercode for std::containers directly that implements the operators
> that are expected for "aggregate on overlap".
>
> ...
>
> Thank you again for your review
>
> Best regards,
> Joachim
>

Joachim,

I wasn't complaining that itl::set was used in the example. I just wanted to
understand:
a) why it was used instead of an adapter class - a more detailed comment in
the example would suffice. Or maybe a comment that they are just adapter
classes in the reference docs for itl::set and itl::map?
b) what else I could use them for since there are no examples for them (some
examples would be great) I am sure there are really useful things that can be
done with them besides the use in the Party example.

Jerry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net