Share via


hash_set::begin (STL/CLR)

Designates the beginning of the controlled sequence.

    iterator begin();

Remarks

The member function returns a bidirectional iterator that designates the first element of the controlled sequence, or just beyond the end of an empty sequence. You use it to obtain an iterator that designates the current beginning of the controlled sequence, but its status can change if the length of the controlled sequence changes.

Example

// cliext_hash_set_begin.cpp 
// compile with: /clr 
#include <cliext/hash_set> 
 
typedef cliext::hash_set<wchar_t> Myhash_set; 
int main() 
    { 
    Myhash_set 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 
    Myhash_set::iterator it = c1.begin(); 
    System::Console::WriteLine("*begin() = {0}", *it); 
    System::Console::WriteLine("*++begin() = {0}", *++it); 
    return (0); 
    } 
 

a b c *begin() = a *++begin() = b

Requirements

Header: <cliext/hash_set>

Namespace: cliext

See Also

Reference

hash_set (STL/CLR)

hash_set::end (STL/CLR)