Partager via


deque : : operator [] (STL/CLR)

Accesses an element at a specified position.

    reference operator[](size_type pos);

Paramètres

  • pos
    Position de l'élément auquel accéder.

Notes

The member operator returns a referene to the element at position pos. You use it to access an element whose position you know.

Exemple

// cliext_deque_operator_sub.cpp 
// compile with: /clr 
#include <cliext/deque> 
 
int main() 
    { 
    cliext::deque<wchar_t> c1; 
    c1.push_back(L'a'); 
    c1.push_back(L'b'); 
    c1.push_back(L'c'); 
 
// display contents " a b c" using subscripting 
    for (int i = 0; i < c1.size(); ++i) 
        System::Console::Write(" {0}", c1[i]); 
    System::Console::WriteLine(); 
 
// change an entry and redisplay 
    c1[1] = L'x'; 
    for (int i = 0; i < c1.size(); ++i) 
        System::Console::Write(" {0}", c1[i]); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

Configuration requise

Header: <cliext/deque>

Namespace: cliext

Voir aussi

Référence

deque (STL/CLR)

deque : : à (STL/CLR)