📜  检查编译器版本 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:49.240000             🧑  作者: Mango

代码示例1
#include 
#include 

int main()
{
    if (__cplusplus == 201703L) std::cout << "C++17\n";
    else if (__cplusplus == 201402L) std::cout << "C++14\n";
    else if (__cplusplus == 201103L) std::cout << "C++11\n";
    else if (__cplusplus == 199711L) std::cout << "C++98\n";
    else std::cout << "pre-standard C++\n";

}