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

The MPL Reference Manual: advance

Boost , ,

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

Front Page / Iterators / Iterator Metafunctions / advance

advance

Synopsis

template<
      typename Iterator
    , typename N
    >
struct advance
{
    typedef unspecified type;
};

Description

Перемещает Итератор на расстояние N. Для итераторов bidirectional и random access расстояние может быть отрицательным.

Parameters

Parameter Requirement Description
Итератор Передний итератор Итератор для продвижения.
N Интегральная постоянная Расстояние.

Expression semantics

Для Forward Iteratoriter и произвольного Integral Constantn:

typedef advance<iter,n>::type j;
Return type:

Forward Iterator.

Precondition:

If Iterator is a Forward Iterator, n::value must be nonnegative.

Semantics:

Equivalent to:

typedef iter i0;
typedef next<i0>::type i1;
...
typedef next<in-1>::type j;

если n:: значение > 0 и

typedef iter i0;
typedef prior<i0>::type i1;
...
typedef prior<in-1>::type j;

иначе.

Postcondition:

j is dereferenceable or past-the-end; distance<iter,j>::value == n::value if n::value > 0, and distance<j,iter>::value == n::value otherwise.

Complexity

Амортизированное постоянное время, если iter является моделью Random Access Iterator, иначе линейное время.

Example

typedef range_c<int,0,10> numbers;
typedef begin<numbers>::type first;
typedef end<numbers>::type last;
typedef advance<first,int_<10> >::type i1;
typedef advance<last,int_<-10> >::type i2;
BOOST_MPL_ASSERT(( boost::is_same<i1,last> ));
BOOST_MPL_ASSERT(( boost::is_same<i2,first> ));

Статья The MPL Reference Manual: advance раздела может быть полезна для разработчиков на c++ и boost.




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



:: Главная :: ::


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 03:19:40/0.0035011768341064/0