Share via


hash_set::lower_bound (STL/CLR)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at hash_set::lower_bound (STL/CLR).

Finds beginning of range that matches a specified key.

Syntax

iterator lower_bound(key_type key);  

Parameters

key
Key value to search for.

Remarks

The member function determines the first element X in the controlled sequence that hashes to the same bucket as key and has equivalent ordering to key. If no such element exists, it returns hash_set::end (STL/CLR)(); otherwise it returns an iterator that designates X. You use it to locate the beginning of a sequence of elements currently in the controlled sequence that match a specified key.

Example

// cliext_hash_set_lower_bound.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();   
  
    System::Console::WriteLine("lower_bound(L'x')==end() = {0}",   
        c1.lower_bound(L'x') == c1.end());   
  
    System::Console::WriteLine("*lower_bound(L'a') = {0}",   
        *c1.lower_bound(L'a'));   
    System::Console::WriteLine("*lower_bound(L'b') = {0}",   
        *c1.lower_bound(L'b'));   
    return (0);   
    }  
  
 a b c  
lower_bound
(L'x')==end
() = True  
*lower_bound
(L'a') = a  
*lower_bound
(L'b') = b  

Requirements

Header: <cliext/hash_set>

Namespace: cliext

See Also

hash_set (STL/CLR)
hash_set::count (STL/CLR)
hash_set::equal_range (STL/CLR)
hash_set::find (STL/CLR)
hash_set::upper_bound (STL/CLR)