Home | Libraries | People | FAQ | More |
T |
discrete |
continuous |
right_open |
left_open |
closed |
open |
---|---|---|---|---|---|---|
Interval bounds |
dynamic |
dynamic |
static |
static |
static |
static |
Form |
asymmetric |
asymmetric |
symmetric |
symmetric |
||
Construct |
||||||
|
||||||
|
||||||
T construct(const P&, const P&, interval_bounds )
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
The table above shows the availability of functions, that allow the construction of intervals. All interval constructin functins are of constant time and space complexity.
Construct |
Description |
---|---|
|
Constructs an interval that contains exactly one element |
|
Contructs an interval with lower bound |
T construct(const P& lower, const P& upper, interval_bounds bounds = interval_bounds::right_open())
|
For dynamically bounded intervals this function constructs an interval with interval bounds specified by the third parameter. |
|
|
|
span<right_open_interval<int> >(2,1) == [1,2) // does NOT contain 2 hull<right_open_interval<int> >(2,1) == [1,3) // contains 2 construct<right_open_interval<int> >(2,1) == [) // is empty
|
static T right_open(const P&, const P&) static T left_open(const P&, const P&) static T closed(const P&, const P&) static T open(const P&, const P&)
|
For dynamically bounded intervals there are for static functions to construct intervals with the four interval bound types: discrete_interval<int> itv1 = discrete_interval<int>::closed(0,42); continuous_interval<double> itv2 = continuous_interval<double>::right_open(0.0, 1.0);
|
Using the interval default |
|
|
There is a library default, for all interval containers of the
icl. The intension of the library
default is to minimize the need for parameter specification, when
working with icl class templates.
We can get the library default interval type as |
static T right_open(const P&, const P&) static T left_open(const P&, const P&) static T closed(const P&, const P&) static T open(const P&, const P&)
|
For template struct interval<int>::type itv1 = interval<int>::closed(0,42); interval<double>::type itv2 = interval<double>::right_open(0.0, 1.0); This works with the statically bounded intervals as well, with the restriction that for continuous domain types the matching function has to be used: #define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS . . . // library default is the statically bounded right_open_interval interval<int>::type itv1 = interval<int>::closed(0,42); //==[0,43) //ok, bounds are shifted interval<double>::type itv2 = interval<double>::right_open(0.0, 1.0); //ok. right_open matches interval<double>::type itv3 = interval<double>::closed(0.0, 1.0); //will NOT compile See also examples Dynamic intervals and Static intervals |
See also . . .
Example: Dynamically bounded intervals and the library default |
Example: Statically bounded intervals, changing the library default |
Back to section . . .