std:: skipws, std:: noskipws
|
定義済みヘッダー
<ios>
|
||
|
std::
ios_base
&
skipws
(
std::
ios_base
&
str
)
;
|
(1) | |
|
std::
ios_base
&
noskipws
(
std::
ios_base
&
str
)
;
|
(2) | |
書式付き入力関数による先頭の空白文字のスキップを有効または無効にします(デフォルトでは有効)。出力には影響しません。
空白文字のスキップは std::basic_istream::sentry のコンストラクタによって実行され、これはストリームに組み込まれたロケールの std::ctype ファセットによって空白として分類される文字を読み取り破棄します。
これはI/Oマニピュレータであり、
out
<<
std
::
noskipws
のように、
out
が
std::basic_ostream
型の場合に呼び出されるか、あるいは
in
>>
std
::
noskipws
のように、
in
が
std::basic_istream
型の場合に呼び出されます。
目次 |
パラメータ
| str | - | 参照するI/Oストリーム |
戻り値
str (操作後のストリームへの参照)。
例
#include <iostream> #include <sstream> int main() { char c1, c2, c3; std::istringstream("a b c") >> c1 >> c2 >> c3; std::cout << "Default behavior:" " c1 = " << c1 << " c2 = " << c2 << " c3 = " << c3 << '\n'; std::istringstream("a b c") >> std::noskipws >> c1 >> c2 >> c3; std::cout << "noskipws behavior:" " c1 = " << c1 << " c2 = " << c2 << " c3 = " << c3 << '\n'; }
出力:
Default behavior: c1 = a c2 = b c3 = c noskipws behavior: c1 = a c2 = c3 = b
関連項目
|
指定された ios_base フラグをクリアする
(関数) |
|
指定された
ios_base
フラグを設定する
(関数) |
|
|
空白文字を消費する
(関数テンプレート) |