|
Boost : |
From: Sylvain Pion (pion_at_[hidden])
Date: 2002-09-05 18:57:40
On Thu, Sep 05, 2002 at 06:49:15PM -0400, David Abrahams wrote:
> I'm not suggesting that it is. I'm only saying that you need something of
> the kind for most applications if you want to use them as map keys. For that
> reason, I'd suggest providing an appropriate compare object type which can
> be passed as an argument to std::map<>.
Note that from this point of view, boost::interval is essentially the same
thing as std::complex.
And unless I'm mistaken, std::complex doesn't provide such an object.
There is currently in the code a commented specialization of std::less for
interval. We need to decide what do with this thing.
I would be on the opinion to not define such an object.
Let's say that it's for the same reasons why there's none for std::complex
either.
> > > It's not unreasonable to think of using a rel_ops approach for these
> > > things, though the operators won't propagate into generic algorithms:
> > >
> > > namespace mine {
> > > boost::interval f(boost::interval* start, boost::interval* finish)
> > > {
> > > using boost::intervals::my_preferred_comparison_ops;
> > >
> > > ... start[0] < start[1] ... ; // ok
> > >
> > > std::sort(start, finish); // error
> > > };
> > > }
> >
> > Yes, and I thought the rel_ops were usually considered evil, because they
> > are too general, right ?
> >
> > So they are there when you don't want them, but they are not there when
> > you want them :)
>
> No, they're usually considered (by me) to be useless, since they don't
> apply inside generic algorithms. Before they were nested inside
> std::rel_ops they were evil.
I see them equally useless for interval.
-- Sylvain
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk