Boost logo

Boost Users :

Subject: [Boost-users] [ICL] interval_map question
From: Antal A. Buss (abuss_at_[hidden])
Date: 2011-05-25 02:55:32


Hi all,

I'm trying to use interval_map to implement some kind of range to
value directory, but I have some non expected results.

The test code I'm using is:
------------------------
#include <iostream>
#include <boost/icl/interval_map.hpp>
#include <boost/icl/discrete_interval.hpp>

using namespace std;
using namespace boost::icl;

int main(int argc, char const **argv)
{
  interval_map<size_t, int> imap;
  typedef discrete_interval<size_t> interval_t;

  imap += make_pair(construct<interval_t>(0, 7, interval_bounds::closed()),0);
  cout << "imap: " << imap << endl;

  imap.set(make_pair(construct<interval_t>(0, 0, interval_bounds::closed()),1));
  cout << "imap: " << imap << endl;

  imap.erase(construct<interval_t>(3, 3, interval_bounds::closed()));
  cout << "imap: " << imap << endl;
}
------------------------

The result I got is:
  imap: {}
  imap: {([0,0]->1)}
  imap: {([0,0]->1)}

but the result I was expecting is:
  imap: {([0,7]->0)}
  imap: {([0,0]->1)((0,7]->0)}
  imap: {([0,0]->1)((0,3)->0)((3,7]->0)}

Do I missing something?

Thanks,
  Antal


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