using namespace std;
typedef boost::icl::closed_interval<boost::uint16_t, std::less> interval_t;
typedef boost::icl::split_interval_set<boost::uint16_t, std::less, interval_t> set_t;
set_t s;
s += interval_t(0x0000, 0xffff);
s += interval_t(0xa000, 0xbfff);
cout << "BAD: " << hex << s << endl;
s.clear();
s += interval_t(0x0000, 0xfffe);
s += interval_t(0xa000, 0xbfff);
cout << "GOOD: " << hex << s << endl;
BAD: {[0,9fff][a000,ffff]}
GOOD: {[0,9fff][a000,bfff][c000,fffe]}
The bad example seems to fail because the set contains 0xffff. In the good example I use 0xfffe.