Compartilhar via


binary_delegate_noreturn (STL/CLR)

A classe genereic descreve um delegate de dois argumentos retorna void.Use-especificar um representante em termos de seu argumento.

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

Parâmetros

  • Arg1
    O tipo do primeiro argumento.

  • Arg2
    O tipo do segundo argumento.

Comentários

O delegado genereic descreve uma função de dois argumentos retorna void.

Observe que para:

binary_delegate_noreturn<int, int> Fun1;

binary_delegate_noreturn<int, int> Fun2;

tipos de Fun1 e Fun2 são sinônimos, enquanto para:

delegate void Fun1(int, int);

delegate void Fun2(int, int);

eles não são do mesmo tipo.

Exemplo

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

Requisitos

Cabeçalho: < cliext/funcional >

Namespace: cliext

Consulte também

Referência

binary_delegate (STL/CLR)

unary_delegate (STL/CLR)

unary_delegate_noreturn (STL/CLR)