Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Interval Construction

Boost , Chapter 1. Boost.Icl , Function Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

ТТ

дискретный
Интервал

непрерывный
Интервал

right_open
Интервал

left_open
Интервал

закрытый
Интервал

открытый
Интервал

Interval bounds

dynamic

dynamic

static

static

static

static

Form

asymmetric

asymmetric

symmetric

symmetric

КонструкцияКонструкцияКонструкция

[ORIG_END] -->

T singleton(const P&)

d

c

d

d

d

d

T construct(const P&, const P&)

d

c

d c

d c

d

d

T construct(const P&, const P&,
            interval_bounds   )

d

c

T hull(const P&, const P&)

d

c

d c

d c

d

d

<Tspan(const P&, constP&)>

d

c

d c

d c

d

d

static T right_open(const P&, const P&)

d

c

static T left_open(const P&, const P&)

d

c

static T closed(const P&, const P&)

d

c

<staticT open(constP&,const P&)>

d

c

В приведенной выше таблице показано наличие функций, позволяющих строить интервалы. Все интервальные конструктин-функции имеютпостоянную сложность времени и пространства.

КонструкцияКонструкцияКонструкция

[ORIG_END] -->

Описание

<Tsingleton(const P& value)>

Constructs an interval that contains exactly one element value. For all interval types of the icl sigletons can be constructed for discrete domain types. For continuous domain types, only continuous_interval is capable to construct a singleton.

T construct(const P& lower, const P& upper)

Contructs an interval with lower bound lower and upper bound upper

T construct(const P& lower, const P& upper,
            interval_bounds bounds
            = interval_bounds::right_open())

Для динамически ограниченных интервалов эта функция конструирует интервал с интервальными границами, указанными третьим параметром.

<Thull(const P& x1, constP&x2)>

hull(x1,x2) constructs the smallest interval that contains both x1 and x2. x2 may be smaller than x1.

<Tspan(const P& x1, constP&x2)>

span(x1,x2) constructs the interval construct(min(x1,x2), max(x1,x2)). Note the differences between span, hull and construct:

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

interval<P>::type

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 interval<P>::type. The library default uses dynamically bounded intervals. You can switch to statically bounded intervals by #define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS prior to icl includes.

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>, которая всегда использует библиотеку по умолчанию, также доступны статические функции для четырех типов, связанных интервалом.

<
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
>

См. также примерыДинамические интервалыиСтатические интервалы

.

См. также:

Вернуться в раздел...


PrevUpHomeNext

Статья Interval Construction раздела Chapter 1. Boost.Icl Function Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Function Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 20:09:06/0.029390811920166/1