Aracılığıyla paylaş


function::target_type

Alır callable nesnesinde bilgileri yazın.

const std::type_info& target_type() const;

Notlar

Üye işlevini verir typeid(void) , *this boş olduğundan aksi verir typeid(T), burada T hedef nesnenin türüdür.

Örnek

 

// std_tr1__functional__function_target_type.cpp 
// compile with: /EHsc 
#include <functional> 
#include <iostream> 
 
int neg(int val) 
    { 
    return (-val); 
    } 
 
int main() 
    { 
    std::function<int (int)> fn0(neg); 
    std::cout << std::boolalpha << "empty == " << !fn0 << std::endl; 
    std::cout << "type == " << fn0.target_type().name() << std::endl; 
 
    std::function<int (int)> fn1; 
    std::cout << std::boolalpha << "empty == " << !fn1 << std::endl; 
    std::cout << "type == " << fn1.target_type().name() << std::endl; 
 
    return (0); 
    } 
 
  

Gereksinimler

Başlık: <functional>

Namespace: std

Ayrıca bkz.

Başvuru

function Class

function::target

Diğer Kaynaklar

<functional> Üyeler