|
Boost Users : |
Subject: [Boost-users] [icl] interval_map<> and overlapping intervals at boundaries
From: sguazt (marco.guazzone_at_[hidden])
Date: 2011-05-21 11:18:42
Hello,
I don't understand the behavior of icl::interval_map<,> on the
following scenario:
1. Before adding a new segment:
{([0.179494,0.679494)->0.333333)([2.51847,3.01847)->0.333333)([3.24221,3.74221)->0.333333)}
2. Add segment: ([3.74221,4.24221)->0.333333)
3. After adding the segment:
{([0.179494,0.679494)->0.333333)([2.51847,3.01847)->0.333333)([3.24221,4.24221)->0.333333)}
What I would expect at step #3 is:
{([0.179494,0.679494)->0.333333)([2.51847,3.01847)->0.333333)([3.24221,4.24221)->0.666667)}
For the sake of clarity I provide a sample code below:
--- [code] ---
#include <boost/icl/interval.hpp>
#include <boost/icl/interval_map.hpp>
#include <iostream>
#include <utility>
namespace icl = ::boost::icl;
int main()
{
typedef double time_type;
typedef double value_type;
typedef icl::interval<time_type> interval_type;
icl::interval_map<time_type,value_type> intervals;
intervals +=
::std::make_pair(interval_type::right_open(0.1794936069088625,
0.6794936069088625), 0.3333333333333333);
intervals +=
::std::make_pair(interval_type::right_open(2.518467327901063,
3.018467327901063), 0.3333333333333333);
intervals +=
::std::make_pair(interval_type::right_open(3.242205294874485,
3.742205294874485), 0.3333333333333333);
std::cout << "Intervals:\n" << intervals << std::endl;
intervals +=
::std::make_pair(interval_type::right_open(3.742205294874485,
4.242205294874486), 0.3333333333333333);
std::cout << "Updated Intervals:\n" << intervals << std::endl;
}
--- [/code] ---
What kind of interval container should I use in order to obtain the
wanted result?
I'm using the SVN trunk version of boost with GCC 4.5.1 (linux x86_64)
Thank you very much for helping me!
Best,
-- Marco
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