function::result_type

The return type of the stored callable object.

typedef Ret result_type;

Remarks

The typedef is a synonym for the type Ret in the template's call signature. You use it to determine the return type of the wrapped callable object.

Example

 

// std_tr1__functional__function_result_type.cpp 
// compile with: /EHsc 
#include <functional> 
#include <iostream> 
 
int neg(int val) 
    { 
    return (-val); 
    } 
 
int main() 
    { 
    std::function<int (int)> fn1(neg); 
    std::cout << std::boolalpha << "empty == " << !fn1 << std::endl; 
 
    std::function<int (int)>::result_type val = fn1(3); 
    std::cout << "val == " << val << std::endl; 
 
    return (0); 
    } 
 
empty == false
val == -3

Requirements

Header: <functional>

Namespace: std

See Also

Reference

function Class

function::target_type