查找与指定的键范围的开头。
iterator lower_bound(key_type key);
参数
- 键
搜索的键值。
备注
成员函数确定。具有相同订单给 key的控制序列中的第一个 X 元素。 如果不存在此类元素,则返回(); multimap::end (STL/CLR)否则它返回将 X的迭代器。 使用其当前找到的元素序列的开头与指定的键在控制序列。
示例
// cliext_multimap_lower_bound.cpp
// compile with: /clr
#include <cliext/map>
typedef cliext::multimap<wchar_t, int> Mymultimap;
int main()
{
Mymultimap c1;
c1.insert(Mymultimap::make_value(L'a', 1));
c1.insert(Mymultimap::make_value(L'b', 2));
c1.insert(Mymultimap::make_value(L'c', 3));
// display contents " [a 1] [b 2] [c 3]"
for each (Mymultimap::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());
Mymultimap::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);
}
要求
页眉: </cliext 映射>
命名空间: cliext