A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../numeric/../string/basic_string/../../io/manip/ws.html below:

std::ws - cppreference.com

Discards leading whitespace from an input stream.

Behaves as an UnformattedInputFunction, except that is.gcount() is not modified. After constructing and checking the sentry object, extracts characters from the stream and discards them until any one of the following conditions occurs:

This is an input-only I/O manipulator, it may be called with an expression such as in >> std::ws for any in of type std::basic_istream.

[edit] Parameters is - reference to input stream [edit] Return value

is (reference to the stream after extraction of consecutive whitespace).

[edit] Notes

If eofbit is set on the stream prior to the call, the construction of the sentry object will set failbit.

[edit] Example

Output:

getline returns:	"     #1 test"
ws + getline returns:	"#1 test"
getline returns:	"	 #2 test"
ws + getline returns:	"#2 test"
getline returns:	"#3 test"
ws + getline returns:	"#3 test"
[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 415 C++98 calling std::ws might not construct the sentry
object (insonsistent with other input functions) required to construct
the sentry object [edit] See also extracts and discards characters until the given character is found
(public member function of std::basic_istream<CharT,Traits>) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4