問題タブ [sstream]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
949 参照

c++ - 読み取りと書き込みの後に `std::stringstream::fail()` が返す値は何ですか? (gcc と clang)

次のコード スニペットを検討してください。


clang++ トランクは、次の結果を出力します。

ワンドボックスで


g++ トランクは次の結果を出力します。

ワンドボックスで


ご覧のとおり、 の値はss.fail()2 つのコンパイラ間で異なります。std::stringstreamこの場合の の動作に関して、規格は何と言っていますか? 既に消費されているストリームに書き込むときにfailbit/を設定するのは実装定義ですか?badbit