在尝试编译以下示例时:
std::chrono::sys_time<std::chrono::microseconds> timestamp;
std::stringstream ss = foo();
ss >> std::chrono::parse("%Y-%m-%d %T", timestamp);我得到了:
error: ‘parse’ is not a member of ‘std::chrono’
15 | ss >> std::chrono::parse("%Y-%m-%d %T", timestamp);
| ^~~~~我没想到会这样,因为我使用的是我能找到的最新的g++。
更多信息:
$ g++-11 --version
g++-11 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0
$ g++-11 -v
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: (...)
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 我使用以下命令进行编译:
g++-11 -std=c++2a -o test time.cc 这就是g++-11.1.0不支持的吗
发布于 2021-08-12 15:02:55
在您最喜欢的C++供应商发布std::chrono::parse之前,free, open-source preview of this part of C++20一直存在。
std::chrono::sys_time<std::chrono::microseconds> timestamp;
std::stringstream ss = foo();
ss >> date::parse("%Y-%m-%d %T", timestamp);https://stackoverflow.com/questions/68756784
复制相似问题