set::begin (STL/CLR)

指定受控制序列的開頭。

    iterator begin();

備註

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

範例

// cliext_set_begin.cpp 
// compile with: /clr 
#include <cliext/set> 
 
typedef cliext::set<wchar_t> Myset; 
int main() 
    { 
    Myset c1; 
    c1.insert(L'a'); 
    c1.insert(L'b'); 
    c1.insert(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 
    Myset::iterator it = c1.begin(); 
    System::Console::WriteLine("*begin() = {0}", *it); 
    System::Console::WriteLine("*++begin() = {0}", *++it); 
    return (0); 
    } 
 
  

需求

標頭: < cliext/設定 >

Namespace: cliext

請參閱

參考

set (STL/CLR)

set::end (STL/CLR)