C++ 11 auto compile time or runtime?

后端 未结 4 842
暖寄归人
暖寄归人 2020-12-02 18:48
auto a = 10;

When compiler knows a is int, at compile time or at run-time? If it deduce type at run-time, will it not aff

4条回答
  •  眼角桃花
    2020-12-02 19:26

    It's done completely at compile time, with no performance difference.

    auto i = 2;
    

    compiles the same as

    int i = 2;
    

提交回复
热议问题