std::result_of - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <type_traits> |
||
|
|
(1) | (desde C++11) |
|
|
(2) | (desde C++11) |
Deduz o tipo de retorno de uma expressão chamada de função em tempo de compilação.
Original:
Deduces the return type of a function call expression at compile time.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipos de membro
Tipo de membro Original: Member type The text has been machine-translated via Google Translate. |
Definition |
type
|
o tipo de retorno da função se Original: the return type of the function The text has been machine-translated via Google Translate. |
Possível implementação
template<class> struct result_of; template<class F, class... ArgTypes> struct result_of<F(ArgTypes...)> { typedef decltype( std::declval<F>()(std::declval<ArgTypes>()...) ) type; };
Exemplo
struct S { double operator()(char, int&); }; int main() { std::result_of<S(char, int&)>::type f = 3.14; // f has type double }
Veja também
obtém o tipo de expressão em contexto não avaliada Original: obtains the type of expression in unevaluated context The text has been machine-translated via Google Translate. (modelo de função) [edit] | |