![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
Interval ConstructionBoost , Chapter 1. Boost.Icl , Function Reference
|
ТТ |
дискретный |
непрерывный |
right_open |
left_open |
закрытый |
открытый |
---|---|---|---|---|---|---|
Interval bounds |
dynamic |
dynamic |
static |
static |
static |
static |
Form |
asymmetric |
asymmetric |
symmetric |
symmetric |
||
Конструкция |
||||||
|
||||||
|
||||||
T construct(const P&, const P&, interval_bounds )
|
||||||
|
||||||
< |
||||||
|
||||||
|
||||||
|
||||||
< |
В приведенной выше таблице показано наличие функций, позволяющих строить интервалы. Все интервальные конструктин-функции имеютпостоянную сложность времени и пространства.
Конструкция |
Описание |
---|---|
< |
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())
|
Для динамически ограниченных интервалов эта функция конструирует интервал с интервальными границами, указанными третьим параметром. |
< |
|
< |
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&)
|
Для структуры шаблона< interval<int>::type itv1=interval<int>::closed(0,42); interval<double>::typeitv2=interval<double>::right_open(0.0,1.0);> Это также работает со статически ограниченными интервалами, с ограничением, что для непрерывных типов доменов должна использоваться функция соответствия: <#defineBOOST_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>::typeitv2=interval<double>::right_open(0.0,1.0);//ok. right_open matches interval<double>::typeitv3=interval<double>::closed(0.0,1.0); //will NOT compile> См. также примерыДинамические интервалыиСтатические интервалы . |
См. также:
Пример: Динамически ограниченные интервалы и библиотека по умолчанию |
Example: Statically bounded intervals, changing the library default |
Вернуться в раздел...
Статья Interval Construction раздела Chapter 1. Boost.Icl Function Reference может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
:: Главная :: Function Reference ::
реклама |