Boost logo

Boost :

From: ncmcantrip (ncm-yahoospam_at_[hidden])
Date: 2001-12-26 03:26:49


I have uploaded to the Boost files section a couple of archives
containing an implementation of a class template extent_set;
look in the folder "extent_set":

  http://groups.yahoo.com/group/boost/files/extent_set/

The zip and tgz archives there are identical. Included in each
is a header file and a test suite.
 
boost::extent_set<> implements a set of half-open ranges on a scalar
type, with automatic splitting and merging, appropriate for managing
ranges of disk blocks or video frames. In use it looks like:
 
  boost::extent_set<int> set; // empty
  set.insert(10, 20); // now contains [10,20)
  set.insert(30, 50); // now contains [10,20) [30,50)
  set.erase(40, 45); // now contains [10,20) [30,40) [45,50)
  set.insert(20, 30); // now contains [10,40) [45,50)
  std::cout << "("
    << set.begin()->first << ","
    << set.begin()->second << ")" << std::endl; // print "(10,40)"

It is implemented using std::map. The insert and erase members are
about as elegant as anything I have ever coded. There are lots of
other extensions possible (e.g. union etc.), but it does everything
I need now.

This is the initial submission. Please 'ave a look.

Nathan Myers
ncm at cantrip dot org


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk