std::result_of
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>| definiert in Header <type_traits>
|
||
template< class > class result_of; //not defined |
(1) | (seit C++11) |
template< class F, class... ArgTypes > class result_of<F(ArgTypes...)>; |
(2) | (seit C++11) |
Leitet den Rückgabetyp einer Funktion Anruf Ausdruck bei der Kompilierung .
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.
You can help to correct and verify the translation. Click here for instructions.
Mitglied Typen
Mitglied Typ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
type
|
der Rückgabetyp der Funktion
F, wenn mit den Argumenten ArgTypes... genanntOriginal: the return type of the function F if called with the arguments ArgTypes...The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Mögliche Implementierung
template<class>
struct result_of;
template<class F, class... ArgTypes>
struct result_of<F(ArgTypes...)>
{
typedef decltype(
std::declval<F>()(std::declval<ArgTypes>()...)
) type;
};
|
Beispiel
struct S {
double operator()(char, int&);
};
int main()
{
std::result_of<S(char, int&)>::type f = 3.14; // f has type double
}
