Comparing typenames in C++

前端 未结 5 1405
孤独总比滥情好
孤独总比滥情好 2021-02-13 18:13

I typed this into a template function, just to see if it would work:

if (T==int)

and the intellisense didn\'t complain. Is this valid C++? What

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-13 18:45

    No, this is not valid C++.

    IntelliSense is not smart enough to find everything that is wrong with code; it would have to fully compile the code to do that, and compiling C++ is very slow (too slow to use for IntelliSense).

提交回复
热议问题