gpt4 book ai didi

c++ - 我需要一些帮助来理解 Nicolai Josuttis 书中的这一段

转载 作者:搜寻专家 更新时间:2023-10-31 00:40:45 26 4
gpt4 key购买 nike

我想对 Nicolai Josuttis 的书“The C++ Standard Library”(第一版)第 518 页的这段内容做一些解释:

These flags are maintained by the class basic_ios and are thus present in all objects of type basic_istream or basic_ostream. However, the stream buffers don't have state flags. One stream buffer can be shared by multiple stream objects, so the flags only represent the state of the stream as found in the last operation. Even this is only the case if goodbit was set prior to this operation. Otherwise the flags may have been set by some earlier operation.

我不明白他所说的“流缓冲区没有状态标志”是什么意思,在这一段的正下方有一个标题为“流状态的成员函数”的表格。

最佳答案

流由两个对象组成:

  1. 实际的流对象(std::istreamstd::ostream,派生自 std::ios )。
  2. 流缓冲区,即派生自 std::streambuf 的类.

状态标志出现在 std::ios 中,但不出现在 std::streambuf 中。

关于c++ - 我需要一些帮助来理解 Nicolai Josuttis 书中的这一段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14177834/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com