C++ 11实验函数

Som*_*ken 0 c++ c++11

每次我使用其中一个新类C++ 11提供类似chrono.h并使用GCC编译它时它警告我C++ 11函数仍然是实验性的,必须启用一个特殊标志才能使用.

它在2014年结束时写到这一点,为什么在至少3.5年后GCC仍将C++ 11标记为"实验性",经过这些年,C++ 11为我们提供的一些功能还没有实现?

如果是这样的话,怎么样?

代码:

#include <chrono>
#include <thread>
int main()
{
    std::this_thread::sleep_for(std::chrono::milliseconds(3000));
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

编译行: g++ Source.cpp -o test.exe

GCC版本:g ++(x86_64-posix-seh-rev0,由MinGW-W64项目构建)4.9.2版权所有(C)2014 Free Software Foundation,Inc.

海湾合作委员会吐出: C:/Program Files/mingw-w64/x86_64-4.9.2-posix-seh-rt_v3-rev0/mingw64/x86_64-w64- mingw32/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires G compiler and library support for the ISO C++ 2011 standard. This support is curr ently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 comp iler options.

bam*_*s53 5

一旦我添加.'-std = c ++ 11'到编译器选项我不再收到错误/警告消息,但我已经意识到了这一点.我很困惑,为什么它没有添加它就给我一个警告.GCC上的当前std不应该是C++ 11吗?为什么还不是这样呢?

那里的软件和构建系统使用默认值并期望它们保持相当稳定.每当新的标准或功能可用时,GCC不会简单地更新默认设置.

如果您需要特定版本的标准,则应明确指定.