Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

priority_queue::value_comp (STL/CLR)

Copies the ordering delegate for two elements.

    value_compare^ value_comp();

The member function returns the ordering delegate used to order the controlled sequence. You use it to compare two values.

// 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); 
    } 
 
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

Header: <cliext/queue>

Namespace: cliext

Community Additions

ADD
Show:
© 2015 Microsoft