unary_delegate_noreturn (STL/CLR)
A classe genereic descreve um delegado de um argumento retorna void.Use-especificar um representante em termos de tipo de argumento.
generic<typename Arg>
delegate void unary_delegate_noreturn(Arg);
Parâmetros
- Arg.
O tipo do argumento.
Comentários
O delegado genereic descreve uma função de um argumento retorna void.
Observe que para:
unary_delegare_noreturn<int> Fun1;
unary_delegare_noreturn<int> Fun2;
tipos de Fun1 e Fun2 são sinônimos, enquanto para:
delegate void Fun1(int);
delegate void Fun2(int);
eles não são do mesmo tipo.
Exemplo
// cliext_unary_delegate_noreturn.cpp
// compile with: /clr
#include <cliext/functional>
void hash_val(wchar_t val)
{
System::Console::WriteLine("hash({0}) = {1}",
val, (val * 17 + 31) % 67);
}
typedef cliext::unary_delegate_noreturn<wchar_t> Mydelegate;
int main()
{
Mydelegate^ myhash = gcnew Mydelegate(&hash_val);
myhash(L'a');
myhash(L'b');
return (0);
}
Requisitos
Cabeçalho: < cliext/funcional >
Namespace: cliext