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.

operator<= (pair) (STL/CLR)

Pair less than or equal comparison.

template<typename Value1,
    typename Value2>
    bool operator<=(pair<Value1, Value2>% left,
        pair<Value1, Value2>% right);


Left pair to compare.


Right pair to compare.

The operator function returns !(right < left). You use it to test whether left is not ordered after right when the two pairs are compared element by element.

// cliext_pair_operator_le.cpp 
// compile with: /clr 
#include <cliext/utility> 
int main() 
    cliext::pair<wchar_t, int> c1(L'x', 3); 
    System::Console::WriteLine("[{0}, {1}]", c1.first, c1.second); 
    cliext::pair<wchar_t, int> c2(L'x', 4); 
    System::Console::WriteLine("[{0}, {1}]", c2.first, c2.second); 
    System::Console::WriteLine("[x 3] <= [x 3] is {0}", 
        c1 <= c1); 
    System::Console::WriteLine("[x 4] <= [x 3] is {0}", 
        c2 <= c1); 
    return (0); 
[x, 3] [x, 4] [x 3] <= [x 3] is True [x 4] <= [x 3] is False

Header: <cliext/utility>

Namespace: cliext

Community Additions

© 2015 Microsoft