Partager via


hash_multimap::lower_bound (STL/CLR)

Finds beginning of range that matches a specified key.

    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_multimap::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_multimap_lower_bound.cpp 
// compile with: /clr 
#include <cliext/hash_map> 
 
typedef cliext::hash_multimap<wchar_t, int> Myhash_multimap; 
int main() 
    { 
    Myhash_multimap c1; 
    c1.insert(Myhash_multimap::make_value(L'a', 1)); 
    c1.insert(Myhash_multimap::make_value(L'b', 2)); 
    c1.insert(Myhash_multimap::make_value(L'c', 3)); 
 
// display contents " [a 1] [b 2] [c 3]" 
    for each (Myhash_multimap::value_type elem in c1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
 
    System::Console::WriteLine("lower_bound(L'x')==end() = {0}", 
        c1.lower_bound(L'x') == c1.end()); 
 
    Myhash_multimap::iterator it = c1.lower_bound(L'a'); 
    System::Console::WriteLine("*lower_bound(L'a') = [{0} {1}]", 
        it->first, it->second); 
    it = c1.lower_bound(L'b'); 
    System::Console::WriteLine("*lower_bound(L'b') = [{0} {1}]", 
        it->first, it->second); 
    return (0); 
    } 
 
 [a 1] [b 2] [c 3]
lower_bound(L'x')==end() = True
*lower_bound(L'a') = [a 1]
*lower_bound(L'b') = [b 2]

Requirements

Header: <cliext/hash_map>

Namespace: cliext

See Also

Reference

hash_multimap (STL/CLR)

hash_multimap::count (STL/CLR)

hash_multimap::equal_range (STL/CLR)

hash_multimap::find (STL/CLR)

hash_multimap::upper_bound (STL/CLR)