is_convertible Class

테스트 종류를 변환할 수 있는 경우입니다.

template<class From, class To>
    struct is_convertible;

매개 변수

  • From
    변환할 원본 형식입니다.

  • Ty
    변환할 대상 형식입니다.

설명

인스턴스 형식의 조건자의 true 경우 보유 식 To to = from;, 어디 from 형식의 개체입니다 From, 제대로 구성 되어 있습니다.

예제

 

// std_tr1__type_traits__is_convertible.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "is_convertible<trivial, int> == " << std::boolalpha 
        << std::is_convertible<trivial, int>::value << std::endl; 
    std::cout << "is_convertible<trivial, trivial> == " << std::boolalpha 
        << std::is_convertible<trivial, trivial>::value << std::endl; 
    std::cout << "is_convertible<char, int> == " << std::boolalpha 
        << std::is_convertible<char, int>::value << std::endl; 
 
    return (0); 
    } 
 
  

요구 사항

헤더: <type_traits>

네임 스페이스: 국방 표준

참고 항목

참조

<type_traits>

is_base_of Class

기타 리소스

<type_traits> 멤버