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

The MPL Reference Manual: erase

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 / Sequences / Intrinsic Metafunctions / erase

erase

Synopsis

template<
      typename Sequence
    , typename First
    , typename Last = unspecified
    >
struct erase
{
    typedef unspecified type;
};

Description

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

Parameters

Parameter Requirement Description
Последовательность Расширяемая последовательность или Расширяемая ассоциативная последовательность Последовательность для стирания.
Первый Передний итератор Итератор к началу диапазона, который будет стерт.
Последний Передний итератор Итератор, прошедший конец диапазона, который будет стерт.

Expression semantics

For any Extensible Sequence s, and iterators pos, first and last into s:

typedef erase<s,first,last>::type r;
Return type:

Extensible Sequence.

Precondition:

[first,last) is a valid range in s.

Semantics:

r is a new sequence, concept-identical to s, of the following elements: [begin<s>::type, pos), [last, end<s>::type).

Postcondition:

The relative order of the elements in r is the same as in s;

size<r>::value == size<s>::value - distance<first,last>::value
typedef erase<s,pos>::type r;
Return type:

Extensible Sequence.

Precondition:

pos is a dereferenceable iterator in s.

Semantics:

Equivalent to

typedef erase< s,pos,next<pos>::type >::type r;

For any Extensible Associative Sequence s, and iterator pos into s:

typedef erase<s,pos>::type r;
Return type:Extensible Sequence.
Precondition:pos is a dereferenceable iterator to s.
Semantics:Erases the element at a specific position pos; equivalent to erase_key<s, deref<pos>::type >::type.
Postcondition:size<r>::value == size<s>::value - 1.

Complexity

Sequence archetype Complexity (the range form)
Расширяемая ассоциативная последовательность Амортизированное постоянное время.
Расширяемая последовательность Квадратный в худшем случае, линейный в лучшем случае.

Example

typedef vector_c<int,1,0,5,1,7,5,0,5> values;
typedef find< values, integral_c<int,7> >::type pos;
typedef erase<values,pos>::type result;
BOOST_MPL_ASSERT_RELATION( size<result>::value, ==, 7 );
typedef find<result, integral_c<int,7> >::type iter;
BOOST_MPL_ASSERT(( is_same< iter, end<result>::type > ));

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




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



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


реклама


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

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