Condividi tramite


binary_delegate_noreturn (STL/CLR)

La classe genereic descrive un delegato a due argomenti che restituisce void.Utilizzarla si specifica un delegato in termini di argomento.

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

Parametri

  • Arg1
    Il tipo del primo argomento.

  • Arg2
    Il tipo del secondo argomento.

Note

Il delegato genereic descrive una funzione a due argomenti che restituisce void.

Si noti che per:

binary_delegate_noreturn<int, int> Fun1;

binary_delegate_noreturn<int, int> Fun2;

i tipi Fun1 e Fun2 sono sinonimi, mentre per:

delegate void Fun1(int, int);

delegate void Fun2(int, int);

non sono dello stesso tipo.

Esempio

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

Requisiti

intestazione: <cliext/funzionale>

Cliext diSpazio dei nomi:

Vedere anche

Riferimenti

binary_delegate (STL/CLR)

unary_delegate (STL/CLR)

unary_delegate_noreturn (STL/CLR)