다음을 통해 공유


function::operator()

Calls a callable object.

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

Parameters

  • TN
    The type of the Nth call argument.

  • tN
    The Nth call argument.

Remarks

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.

Example

 

// 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

Requirements

Header: <functional>

Namespace: std

See Also

Reference

function Class

function::target