다음을 통해 공유


function::target_type

Gets type information on the callable object.

const std::type_info& target_type() const;

설명

The member function returns typeid(void) if *this is empty, otherwise it returns typeid(T), where T is the type of the target object.

예제

 

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

요구 사항

헤더: <기능>

네임스페이스: std

참고 항목

참조

function 클래스

function::target

기타 리소스

<functional> 멤버