binary_delegate (STL/CLR)
Visual Studio 2008
The genereic class describes a two-argument delegate. You use it specify a delegate in terms of its argument and return types.
generic<typename Arg1,
typename Arg2,
typename Result>
delegate Result binary_delegate(Arg1, Arg2);
// cliext_binary_delegate.cpp
// compile with: /clr
#include <cliext/functional>
bool key_compare(wchar_t left, wchar_t right)
{
return (left < right);
}
typedef cliext::binary_delegate<wchar_t, wchar_t, bool> Mydelegate;
int main()
{
Mydelegate^ kcomp = gcnew Mydelegate(&key_compare);
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();
return (0);
}