priority_queue::value_compare (STL/CLR)
兩個值的排序委派。
binary_delegate<value_type, value_type, int> value_compare;
備註
這個型別是判斷第一個引數是否在第二個之前已排序之委派的同義字。
範例
// cliext_priority_queue_value_compare.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/queue>
命名空間: cliext