On Monday, 3 September 2012 at 04:56:54 UTC, Jonathan M Davis wrote:

It could take a std.aglorithm.openRight as its third, parameter, then you could choose to do one or the other. It just becomes a question of which is
the default.

Certainly, my natural inclination is to go with having intervals be open on the right, but if you have a choice, it's less of an issue regardless of which
is the default.

- Jonathan M Davis

http://www.boost.org/doc/libs/1_51_0/libs/icl/doc/html/index.html

Recently at work, I was quite pleasantly surprised by the boost solution... it solves a number of problems quite elegantly, different policies for handling overlapping ranges and etc... and found myself wishing for the same in D.

ex.

typedef std::set<string> guests;
interval_map<time, guests> party;
party += make_pair(interval<time>::right_open(time("20:00"), time("22:00")), guests("Mary")); party += make_pair(interval<time>::right_open(time("21:00"), time("23:00")), guests("Harry"));

// party now contains
[20:00, 21:00)->{"Mary"}
[21:00, 22:00)->{"Harry","Mary"} //guest sets aggregated on overlap
[22:00, 23:00)->{"Harry"}

Reply via email to