Export (0) Print
Expand All

function::operator()

Calls a callable object.

result_type operator()(T1 t1, T2 t2, ..., TN tN);

TN

The type of the Nth call argument.

tN

The Nth call argument.

The member function returns INVOKE(fn, t1, t2, ..., tN, Ret), where fn is the target object stored in *this. You use it to call the wrapped callable object.

 

// std_tr1__functional__function_operator_call.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::cout << "val == " << fn1(3) << std::endl; 
 
    return (0); 
    } 
 
empty == false
val == -3

Header: <functional>

Namespace: std

Show:
© 2014 Microsoft