Partager via


function::operator()

Appelle un objet appelable.

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

Paramètres

  • TN
    Le type du énième argument appelant.

  • tN
    Le nième argument appelant.

Notes

La fonction membre retourne INVOKE(fn, t1, t2, ..., tN, Ret), où fn est l'objet cible stocké dans *this. Vous l'utilisez pour appeler l'objet appelable inclus.

Exemple

 

// 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); 
    } 
 
  

Configuration requise

En-tête : <functional>

Espace de noms : std

Voir aussi

Référence

function, classe

function::target