Boost logo

Boost :

Subject: [boost] Fwd: [ICL] some improvement proposals
From: Denis (comp.lib.boost.devel_at_[hidden])
Date: 2011-05-19 01:32:12


Hi

1. (questionable because it changes the visible interface): rename
`left_open` and `right_open` to `right_closed` and `left_closed`.

Reason: interval_bounds is used in bitwise operations with bit=1 means
`closed`.

`left_closed() | open()` resulting in `left_closed()` is more readable than
`right_open() | open()` resulting in `left_closed()`.

Also, there are checkers `is_left_closed()` and `is_right_closed()` but not
for *_open

I had to use `class bounded_value` in my program (as in Icl details:
calculating lower and upper bound of interval separately, then constructing
the interval, bitwise or'ing bounds)
and I commented every usage of `right_open()` as `left closed` in order to
explain why I use `interval_bounds::*right*_open()` in constructing the *left
`*bounded_value` of the interval.
This resulted in the idea of renaming.

Maybe making bit=1 mean `open` would be less painful for other users ?

2. define `contains(interval, elt)` as `!below(interval, elt) &&
!above(interval, elt)` allowing the user to use `below()` and `above()`.
Sometimes it is useful.
Anyway, all the versions of `contains()` are made of checking for both
bounds.

3. It would nice if the functions taking two intervals will have versions
taking an element as second argument.
I mean functions like `left_subtract`, `operator &`, etc. (I cannot tell all
the list at the moment)
Constructing temporary `close_interval` object in order only to pass it into
those functions is cheap with ints but would be expensive with
heap-allocated domains (blobs, strings, etc).


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