priority_queue::value_comp (STL/CLR)
复制两个元素的排序委托。
value_compare^ value_comp();
备注
成员函数返回该排序的委托用于对控件序列。 用于对两个值进行比较。
示例
// cliext_priority_queue_value_comp.cpp
// compile with: /clr
#include <cliext/queue>
typedef cliext::priority_queue<wchar_t> Mypriority_queue;
int main()
{
Mypriority_queue c1;
Mypriority_queue::value_compare^ vcomp = c1.value_comp();
System::Console::WriteLine("compare(L'a', L'a') = {0}",
vcomp(L'a', L'a'));
System::Console::WriteLine("compare(L'a', L'b') = {0}",
vcomp(L'a', L'b'));
System::Console::WriteLine("compare(L'b', L'a') = {0}",
vcomp(L'b', L'a'));
System::Console::WriteLine();
// test a different ordering rule
Mypriority_queue c2 = cliext::greater<wchar_t>();
vcomp = c2.value_comp();
System::Console::WriteLine("compare(L'a', L'a') = {0}",
vcomp(L'a', L'a'));
System::Console::WriteLine("compare(L'a', L'b') = {0}",
vcomp(L'a', L'b'));
System::Console::WriteLine("compare(L'b', L'a') = {0}",
vcomp(L'b', L'a'));
return (0);
}
要求
标题: <cliext/队列>
命名空间: cliext