hash_multimap::upper_bound (STL/CLR)

查找与指定的键范围的末尾。

    iterator upper_bound(key_type key);

参数


  • 搜索的键值。

备注

成员函数确定在哈希到存储桶和 key 相同具有相同顺序对 key的控件序列的最后一个元素 X 。如果不存在这样的元素,或者,如果 X 位于控件序列的最后一个元素,则返回 hash_multimap::end (STL/CLR)();否则返回指定在 X外的第一个元素的迭代器。使用该当前所位于的元素序列的末尾与指定的键控件序列。

示例

// cliext_hash_multimap_upper_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("upper_bound(L'x')==end() = {0}", 
        c1.upper_bound(L'x') == c1.end()); 
 
    Myhash_multimap::iterator it = c1.upper_bound(L'a'); 
    System::Console::WriteLine("*upper_bound(L'a') = [{0} {1}]", 
        it->first, it->second); 
    it = c1.upper_bound(L'b'); 
    System::Console::WriteLine("*upper_bound(L'b') = [{0} {1}]", 
        it->first, it->second); 
    return (0); 
    } 
 
  

要求

标题: <cliext/hash_map>

命名空间: cliext

请参见

参考

hash_multimap (STL/CLR)

hash_multimap::count (STL/CLR)

hash_multimap::equal_range (STL/CLR)

hash_multimap::find (STL/CLR)

hash_multimap::lower_bound (STL/CLR)