共用方式為


list::begin (STL/CLR)

指定受控制序列的開頭。

    iterator begin();

備註

成員函式會傳回種隨機存取 iterator,指派受控制序列中,或只是超出空序列結尾的第一個項目。 您要用它來取得的 Iterator 可指定受控制序列之 current 開頭,但是,如果受控制序列的長度變更,它的狀態也可以變更。

範例

// cliext_list_begin.cpp 
// compile with: /clr 
#include <cliext/list> 
 
int main() 
    { 
    cliext::list<wchar_t> c1; 
    c1.push_back(L'a'); 
    c1.push_back(L'b'); 
    c1.push_back(L'c'); 
 
// display initial contents " a b c" 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// inspect first two items 
    cliext::list<wchar_t>::iterator it = c1.begin(); 
    System::Console::WriteLine("*begin() = {0}", *it); 
    System::Console::WriteLine("*++begin() = {0}", *++it); 
 
// alter first two items and reinspect 
    *--it = L'x'; 
    *++it = L'y'; 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

需求

標頭: < cliext/清單 >

Namespace: cliext

請參閱

參考

list (STL/CLR)

list::end (STL/CLR)

list::front (STL/CLR)

list::front_item (STL/CLR)