binary_delegate_noreturn (STL/CLR)

genereic 类描述返回 void的两参数委托。 使用该指定委托根据其参数。

generic<typename Arg1,
    typename Arg2>
    delegate void binary_delegate(Arg1, Arg2);

参数

  • Arg1
    第一个参数的类型。

  • Arg2
    第二个参数的类型为 。

备注

genereic 描述委托返回 void的两参数函数。

请注意:

binary_delegate_noreturn<int, int> Fun1;

binary_delegate_noreturn<int, int> Fun2;

Fun1 和 Fun2 类型是同义词,那么,当进行针对:

delegate void Fun1(int, int);

delegate void Fun2(int, int);

它们不是同一类型。

示例

// cliext_binary_delegate_noreturn.cpp 
// compile with: /clr 
#include <cliext/functional> 
 
void key_compare(wchar_t left, wchar_t right) 
    { 
    System::Console::WriteLine("compare({0}, {1}) = {2}", 
        left, right, left < right); 
    } 
 
typedef cliext::binary_delegate_noreturn<wchar_t, wchar_t> Mydelegate; 
int main() 
    { 
    Mydelegate^ kcomp = gcnew Mydelegate(&key_compare); 
 
    kcomp(L'a', L'a'); 
    kcomp(L'a', L'b'); 
    kcomp(L'b', L'a'); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

要求

头文件: <cliext/functional>

Namespace: cliext

请参见

参考

binary_delegate (STL/CLR)

unary_delegate (STL/CLR)

unary_delegate_noreturn (STL/CLR)