我想知道我需要使用新的 gcc 版本 std::chrono::from_stream
。我使用的是 10.1.0
,但编译器不知道该名称。我在 GNU cxx status page 上没有看到该功能的任何痕迹。谢谢!
#include <chrono>
std::chrono::from_stream(stream, "%Y-%m-%d %H:%M:%S", timeDuration);
error: no member named 'from_stream' in namespace 'std::chrono' [clang-diagnostic-error]
std::chrono::from_stream(stream, "%Y-%m-%d %H:%M:%S", timeDuration);
# g++ --version
g++ (GCC) 10.1.0
最佳答案
Your link用于 C++ 编译器状态。 Here is the status of the gcc std::lib 。当我写这篇文章时,它还没有实现(尽管我知道工作已经开始)。
在可用之前,here is a free, open-source preview of this part of C++20 。 from_stream
(和 parse
)位于命名空间 date
中,而不是命名空间 std::chrono
中,并且位于 header date.h
.
关于c++ - std::chrono::from_stream gcc 可用性,在 gcc 10.1.0 中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68865833/