Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5561: error on calculating interval_map intersection
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-25 12:56:27
#5561: error on calculating interval_map intersection
------------------------------+---------------------------------------------
Reporter: denis@⦠| Owner: jofaber
Type: Bugs | Status: new
Milestone: Boost 1.47.0 | Component: ICL
Version: Boost 1.46.1 | Severity: Problem
Resolution: | Keywords:
------------------------------+---------------------------------------------
Comment (by jofaber):
Hi Denis,
as already mentioned in private mail, the behavior that you consider
erroneous is correct and follows the specification (see docs). Since
interval_maps perform aggregation on overlap, they pass a type's combine-
operation to combine associated values for `+` and they pass a type's
intersecting operation to intersect associated values on overlap, if an
intersection is called on the interval_map.
This is only possible if the type of the associated values (codomain_type)
implements an intersection operation for operator &.
so
||`Q = interval_map<T, Numeric>` ||is a Quantifier not having set
semantics ||
||`interval_map<T, Q>` ||is a Quantifier not having set
semantics ||
||`C = interval_map<T, Set>` ||is a Collector that has set semantics
||
||`interval_map<T, C>` ||is a Collector that has set semantics
||
For Quantifiers, the intersection operations & degenerates to +.
See also
http://www.joachim-
faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/semantics/collectors__maps_of_sets.html
http://www.joachim-
faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/semantics/quantifiers__maps_of_numbers.html
What you always can do is this
{{{#!c++
//Define a user defined type ...
class MySettic
{
// Has some kind of intersection
MySettic& operator &= (const MySettic& rhs){...};
. . .
};
//... make it have set semantics by partial specialization
//of template icl::is_set
namespace boost{ namespace icl
{
struct is_set<MySettic>
{
typedef is_set<bits<NaturalT> > type;
BOOST_STATIC_CONSTANT(bool, value = true);
};
} }
//... and then use it in your interval maps.
interval_map<int, MySettic> myIMap;
}}}
HTH, Best regards,
Joachim
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5561#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC