【问题标题】:std::chrono::from_stream gcc availability, is unavailable in gcc 10.1.0std::chrono::from_stream gcc 可用性,在 gcc 10.1.0 中不可用
【发布时间】:2021-08-20 17:10:05
【问题描述】:

我想知道我需要使用什么版本的 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

【问题讨论】:

  • 它是标准库的一部分。您需要查看标准库提供的功能。我猜他们还没有解决这个问题。
  • 目前似乎只提供部分支持。在此处查看 P0355 的列表:en.cppreference.com/w/cpp/compiler_support/20
  • 这是一个很棒的链接,@NathanOliver。我通常以here 结尾,但你的更容易浏览。

标签: c++ gcc c++20


【解决方案1】:

Your link 用于 C++ 编译器状态。 Here is the status of the gcc std::lib。在我写这篇文章时,它还没有实现(尽管我知道工作已经开始)。

在它可用之前,here is a free, open-source preview of this part of C++20from_stream(和parse)在namespace date而不是namespace std::chrono中,并且在标题date.h中。

【讨论】:

    猜你喜欢
    • 2019-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 2018-05-31
    • 2015-08-17
    相关资源
    最近更新 更多