[Boost-bugs] [Boost C++ Libraries] #5561: error on calculating interval_map intersection

Subject: [Boost-bugs] [Boost C++ Libraries] #5561: error on calculating interval_map intersection
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-24 06:53:00


#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
 Keywords: |
-----------------------------+----------------------------------------------
 here is the test case, reproducible with boost 1.46.1 and the today trunk.
 {{{
 #include <iostream>
 #include <assert.h>
 #include <boost/icl/interval_set.hpp>
 #include <boost/icl/interval_map.hpp>


 int main() {
   typedef boost::icl::interval_map<int, boost::icl::interval_set<int>> I1;
   I1 i(std::make_pair(0, 100)),
      j(std::make_pair(0, 200));
   std::cout << i << std::endl; // {([0,0]->{[100,100]})}
   std::cout << j << std::endl; // {([0,0]->{[200,200]})}
   std::cout << (i+j) << std::endl; // {([0,0]->{[100,100][200,200]})}
   std::cout << (i-j) << std::endl; // {([0,0]->{[100,100]})}
   std::cout << (i&j) << std::endl; // {}
   assert((i&j).empty());

   // suppose to work same way as the test above
   typedef boost::icl::interval_map<int, boost::icl::interval_map<int,
 int>> I2;
   I2 k(std::make_pair(0, std::make_pair(100, 1))),
      l(std::make_pair(0, std::make_pair(200, 1)));
   std::cout << k << std::endl; // {([0,0]->{([100,100]->1)})}
   std::cout << l << std::endl; // {([0,0]->{([200,200]->1)})}
   std::cout << (k+l) << std::endl; //
 {([0,0]->{([100,100]->1)([200,200]->1)})}
   std::cout << (k-l) << std::endl; // {([0,0]->{([100,100]->1)})}
   std::cout << (k&l) << std::endl; //
 {([0,0]->{([100,100]->1)([200,200]->1)})} while expecting {}
   assert((k&l).empty());
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5561>
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