Why can't std::ostream be moved?

后端 未结 1 1893
礼貌的吻别
礼貌的吻别 2020-11-29 04:06

Clearly, streams can\'t be copied. It should be possible to move streams. According to 27.9.1.11 [ofstream.cons] paragraph 4 it is possible to move construct an std::o

相关标签:
1条回答
  • 2020-11-29 04:19

    Originally they were movable. This turned out to be a design flaw on my part, and discovered by Alberto Ganesh Barbati:

    http://cplusplus.github.io/LWG/lwg-defects.html#911

    The issue shows a few examples where ostream gets moved and/or swapped, and the results are surprising, instead of expected. I was convinced that these types should not be publicly movable nor swappable by this issue.

    0 讨论(0)
提交回复
热议问题