Using 'auto' type deduction - how to find out what type the compiler deduced?

前端 未结 11 1347
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 07:54

How can I find out what type the compiler deduced when using the auto keyword?

Example 1: Simpler

auto tickTime = 0.001;

W

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 08:44

    The type deduced by the compiler is in the error message:

    /usr/include/c++/4.8.2/ostream:602:5: error:   initializing argument 1 of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits;
     _Tp = std::chrono::time_point > >]’
      ^^   <-------- the long type name --------------------------------------------------------------------------------------->
    

    It's a complicated type name but it is there in the error message.

提交回复
热议问题