본문 바로가기
Language/effective modern C++

Effective modern C++ ( 형식 언어 )

by y.j 2021. 10. 14.
728x90

형식언어

항목 4: 연역된 형식을 파악하는 방법을 알아두라

  1. IDE편집기

    마우스 커서를 올려 놓으면 연역을 확인해 준다.
  2. 컴파일러 진단 메시지
    원하는 형식에 컴파일러 에러 문제가 발생하게 만드는 것이다.
template<typename T> class TD;

auto x = theAnswer;  
auto y = &theAnswer;

TD<decltype(x)> xType;  
TD<decltype(y)> yType;
error: aggreate 'TD xType' has incomplete type and cannot be defined.
error: aggreate 'TD<const int *> yType' has incomplete type and cannot be defined.
  1. 실행시점 출력
728x90

댓글