Partager via


deque (STL/CLR)

The template class describes an object that controls a varying-length sequence of elements that has random access. You use the container deque to manage a sequence of elements that looks like a contiguous block of storage, but which can grow or shrink at either end without the need to copy any remaining elements. Thus it can implement efficiently a double-ended queue. (Hence the name.)

In the description below, GValue is the same as Value unless the latter is a ref type, in which case it is Value^.

template<typename Value>
    ref class deque
        :   public
        System::ICloneable,
        System::Collections::IEnumerable,
        System::Collections::ICollection,
        System::Collections::Generic::IEnumerable<GValue>,
        System::Collections::Generic::ICollection<GValue>,
        System::Collections::Generic::IList<GValue>,
        Microsoft::VisualC::StlClr::IDeque<GValue>
    { ..... };

Paramètres

  • GValue
    The generic type of an element in the controlled sequence.

  • Valeur
    Type d'un élément dans la séquence contrôlée.

Membres

Type Definition

Description

deque : : const_iterator (STL/CLR)

Type d'un itérateur constant pour la séquence contrôlée.

deque : : const_reference (STL/CLR)

Type d'une référence constante à un élément.

deque : : const_reverse_iterator (STL/CLR)

The type of a constant reverse iterator for the controlled sequence.

deque : : difference_type (STL/CLR)

Type d'une distance signée entre deux éléments.

deque : : generic_container (STL/CLR)

The type of the generic interface for the container.

deque : : generic_iterator (STL/CLR)

The type of an iterator for the generic interface for the container.

deque : : generic_reverse_iterator (STL/CLR)

The type of a reverse iterator for the generic interface for the container.

deque : : generic_value (STL/CLR)

The type of an element for the generic interface for the container.

deque : : itérateur (STL/CLR)

Type d'un itérateur pour la séquence contrôlée.

deque : : référence (STL/CLR)

Type d'une référence à un élément.

deque : : reverse_iterator (STL/CLR)

The type of a reverse iterator for the controlled sequence.

deque : : size_type (STL/CLR)

Type d'une distance signée entre deux éléments.

deque : : value_type (STL/CLR)

Le type d'un élément.

Member Function

Description

deque : : assignez (STL/CLR)

Replaces all elements.

deque : : à (STL/CLR)

Accesses an element at a specified position.

deque : : DOS (STL/CLR)

Accesses the last element.

deque : : démarrez (STL/CLR)

Désigne le début de la séquence contrôlée.

deque : : espace libre (STL/CLR)

Removes all elements.

deque : : deque (STL/CLR)

Construit un objet container.

deque : : vide (STL/CLR)

Tests whether no elements are present.

deque : : fin (STL/CLR)

Désigne la fin de la séquence contrôlée.

deque : : effacement (STL/CLR)

Supprime les éléments placés aux positions spécifiées.

deque : : avant (STL/CLR)

Accesses the first element.

deque : : insertion (STL/CLR)

Adds elements at a specified position.

deque : : pop_back (STL/CLR)

Removes the last element.

deque : : pop_front (STL/CLR)

Removes the first element.

deque : : push_back (STL/CLR)

Adds a new last element.

deque : : push_front (STL/CLR)

Adds a new first element.

deque : : rbegin (STL/CLR)

Désigne le début de la séquence contrôlée inversée.

deque : : rend (STL/CLR)

Désigne la fin de la séquence contrôlée inversée.

deque : : redimensionnez (STL/CLR)

Change le nombre d'éléments.

deque : : taille (STL/CLR)

Compte le nombre d'éléments.

deque : : échange (STL/CLR)

Échange le contenu de deux conteneurs.

deque : : to_array (STL/CLR)

Copies the controlled sequence to a new array.

Propriété

Description

deque : : back_item (STL/CLR)

Accesses the last element.

deque : : front_item (STL/CLR)

Accesses the first element.

Opérateur

Description

deque : : opérateur ! = (STL/CLR)

Détermine si deux objets deque ne sont pas égaux.

deque : : operator [] (STL/CLR)

Accesses an element at a specified position.

operator< (deque) (STL/CLR)

Determines if a deque object is less than another deque object.

operator<= (deque) (STL/CLR)

Determines if a deque object is less than or equal to another deque object.

operator= (deque) (STL/CLR)

Replaces the controlled sequence.

operator== (deque) (STL/CLR)

Determines if a deque object is equal to another deque object.

operator> (deque) (STL/CLR)

Determines if a deque object is greater than another deque object.

operator>= (deque) (STL/CLR)

Determines if a deque object is greater than or equal to another deque object.

Interfaces

Interface

Description

ICloneable

Duplicate an object.

IEnumerable

Sequence through elements.

ICollection

Maintain group of elements.

IEnumerable

Sequence through typed elements.

ICollection

Maintain group of typed elements.

IList

Maintain ordered group of typed elements.

IDeque<Value>

Maintain generic container.

Notes

The object allocates and frees storage for the sequence it controls through a stored array of handles that designate blocks of Value elements. The array grows on demand. Growth occurs in such a way that the cost of either prepending or appending a new element is constant time, and no remaining elements are disturbed. You can also remove an element at either end in constant time, and without disturbing remaining elements. Thus, a deque is a good candidate for the underlying container for template class queue (STL/CLR) or template class stack (STL/CLR).

A deque object supports random-access iterators, which means you can refer to an element directly given its numerical position, counting from zero for the first (front) element, to deque : : taille (STL/CLR)() - 1 for the last (back) element. It also means that a deque is a good candidate for the underlying container for template class priority_queue (STL/CLR).

A deque iterator stores a handle to its associated deque object, along with the bias of the element it designates. You can use iterators only with their associated container objects. The bias of a deque element is not necessarily the same as its position. The first element inserted has bias zero, the next appended element has bias 1, but the next prepended element has bias -1.

Inserting or erasing elements at either end does not alter the value of an element stored at any valid bias. Inserting or erasing an interior element, however, can change the element value stored at a given bias, so the value designated by an iterator can also change. (The container may have to copy elements up or down to create a hole before an insert or to fill a hole after an erase.) Nevertheless, a deque iterator remains valid so long as its bias designates a valid element. Moreover, a valid iterator remains dereferencable -- you can use it to access or alter the element value it designates -- so long as its bias is not equal to the bias for the iterator returned by end().

Erasing or removing an element calls the destructor for its stored value. Destroying the container erases all elements. Thus, a container whose element type is a ref class ensures that no elements outlive the container. Note, however, that a container of handles does not destroy its elements.

Configuration requise

Header: <cliext/deque>

Namespace: cliext

Voir aussi

Référence

list (STL/CLR)

priority_queue (STL/CLR)

queue (STL/CLR)

stack (STL/CLR)

vector (STL/CLR)

Autres ressources

Référence de bibliothèque STL/CLR