set::key_compare (STL/CLR)

两个密钥的排序委托。

    Microsoft::VisualC::StlClr::BinaryDelegate<GKey, GKey, bool>
        key_compare;

备注

该类型确定其排序关键字变量的委托的同义词。

示例

// cliext_set_key_compare.cpp 
// compile with: /clr 
#include <cliext/set> 
 
typedef cliext::set<wchar_t> Myset; 
int main() 
    { 
    Myset c1; 
    Myset::key_compare^ kcomp = c1.key_comp(); 
 
    System::Console::WriteLine("compare(L'a', L'a') = {0}", 
        kcomp(L'a', L'a')); 
    System::Console::WriteLine("compare(L'a', L'b') = {0}", 
        kcomp(L'a', L'b')); 
    System::Console::WriteLine("compare(L'b', L'a') = {0}", 
        kcomp(L'b', L'a')); 
    System::Console::WriteLine(); 
 
// test a different ordering rule 
    Myset c2 = cliext::greater<wchar_t>(); 
    kcomp = c2.key_comp(); 
 
    System::Console::WriteLine("compare(L'a', L'a') = {0}", 
        kcomp(L'a', L'a')); 
    System::Console::WriteLine("compare(L'a', L'b') = {0}", 
        kcomp(L'a', L'b')); 
    System::Console::WriteLine("compare(L'b', L'a') = {0}", 
        kcomp(L'b', L'a')); 
    return (0); 
    } 
 
  

要求

标题: <cliext/设置>

命名空间: cliext

请参见

参考

set (STL/CLR)

set::key_comp (STL/CLR)

set::key_type (STL/CLR)

set::value_compare (STL/CLR)