Dela via


priority_queue::value_compare (STL/CLR)

The ordering delegate for two values.

    binary_delegate<value_type, value_type, int> value_compare;

Remarks

The type is a synonym for the delegate that determines whether the first argument is ordered before the second.

Example

// 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); 
    } 
 
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

compare(L'a', L'a') = False
compare(L'a', L'b') = False
compare(L'b', L'a') = True

Requirements

Header: <cliext/queue>

Namespace: cliext

See Also

Reference

priority_queue (STL/CLR)

priority_queue::value_comp (STL/CLR)

priority_queue::value_type (STL/CLR)