| title | binary_delegate_noreturn (STL/CLR) | Microsoft Docs | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||
| ms.reviewer | ||||||||||||||
| ms.suite | ||||||||||||||
| ms.technology |
|
|||||||||||||
| ms.tgt_pltfrm | ||||||||||||||
| ms.topic | reference | |||||||||||||
| f1_keywords |
|
|||||||||||||
| dev_langs |
|
|||||||||||||
| helpviewer_keywords |
|
|||||||||||||
| ms.assetid | 055c7e9d-e5c3-48fe-9327-3f6316e8a51e | |||||||||||||
| caps.latest.revision | 8 | |||||||||||||
| author | mikeblome | |||||||||||||
| ms.author | mblome | |||||||||||||
| manager | ghogen | |||||||||||||
| translation.priority.ht |
|
The genereic class describes a two-argument delegate that returns void. You use it specify a delegate in terms of its argument.
generic<typename Arg1,
typename Arg2>
delegate void binary_delegate(Arg1, Arg2);
Arg1
The type of the first argument.
Arg2
The type of the second argument.
The genereic delegate describes a two-argument function that returns void.
Note that for:
binary_delegate_noreturn<int, int> Fun1;
binary_delegate_noreturn<int, int> Fun2;
the types Fun1 and Fun2 are synonyms, while for:
delegate void Fun1(int, int);
delegate void Fun2(int, int);
they are not the same type.
// 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);
}
compare(a, a) = False
compare(a, b) = True
compare(b, a) = False
Header: <cliext/functional>
Namespace: cliext
binary_delegate (STL/CLR)
unary_delegate (STL/CLR)
unary_delegate_noreturn (STL/CLR)