29 Input/output library [input.output]

29.7 Formatting and manipulators [iostream.format]

29.7.4 Input streams [input.streams]

29.7.4.3 Formatted input functions [istream.formatted]

29.7.4.3.3 basic_­istream​::​operator>> [istream.extractors]

basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& (*pf)(basic_istream<charT, traits>&));
Effects: None.
This extractor does not behave as a formatted input function (as described in [istream.formatted.reqmts]).
Returns: pf(*this).
307
basic_istream<charT, traits>& operator>>(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
Effects: Calls pf(*this).
This extractor does not behave as a formatted input function (as described in [istream.formatted.reqmts]).
Returns: *this.
basic_istream<charT, traits>& operator>>(ios_base& (*pf)(ios_base&));
Effects: Calls pf(*this).308
This extractor does not behave as a formatted input function (as described in [istream.formatted.reqmts]).
Returns: *this.
template<class charT, class traits, size_t N> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& in, charT (&s)[N]); template<class traits, size_t N> basic_istream<char, traits>& operator>>(basic_istream<char, traits>& in, unsigned char (&s)[N]); template<class traits, size_t N> basic_istream<char, traits>& operator>>(basic_istream<char, traits>& in, signed char (&s)[N]);
Effects: Behaves like a formatted input member (as described in [istream.formatted.reqmts]) of in.
After a sentry object is constructed, operator>> extracts characters and stores them into s.
If width() is greater than zero, n is min(size_­t(width()), N).
Otherwise n is N.
n is the maximum number of characters stored.
Characters are extracted and stored until any of the following occurs:
  • n-1 characters are stored;
  • end of file occurs on the input sequence;
  • letting ct be use_­facet<ctype<charT>>(in.getloc()), ct.is(ct.space, c) is true.
operator>> then stores a null byte (charT()) in the next position, which may be the first position if no characters were extracted.
operator>> then calls width(0).
If the function extracted no characters, it calls setstate(failbit), which may throw ios_­base​::​​failure ([iostate.flags]).
Returns: in.
template<class charT, class traits> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& in, charT& c); template<class traits> basic_istream<char, traits>& operator>>(basic_istream<char, traits>& in, unsigned char& c); template<class traits> basic_istream<char, traits>& operator>>(basic_istream<char, traits>& in, signed char& c);
Effects: Behaves like a formatted input member (as described in [istream.formatted.reqmts]) of in.
After a sentry object is constructed a character is extracted from in, if one is available, and stored in c.
Otherwise, the function calls in.setstate(failbit).
Returns: in.
basic_istream<charT, traits>& operator>>(basic_streambuf<charT, traits>* sb);
Effects: Behaves as an unformatted input function.
If sb is null, calls setstate(failbit), which may throw ios_­base​::​failure ([iostate.flags]).
After a sentry object is constructed, extracts characters from *this and inserts them in the output sequence controlled by sb.
Characters are extracted and inserted until any of the following occurs:
  • end-of-file occurs on the input sequence;
  • inserting in the output sequence fails (in which case the character to be inserted is not extracted);
  • an exception occurs (in which case the exception is caught).
If the function inserts no characters, it calls setstate(failbit), which may throw ios_­base​::​​failure ([iostate.flags]).
If it inserted no characters because it caught an exception thrown while extracting characters from *this and failbit is set in exceptions() ([iostate.flags]), then the caught exception is rethrown.
Returns: *this.
See, for example, the function signature ws(basic_­istream&) ([istream.manip]).
 â®¥
See, for example, the function signature dec(ios_­base&) ([basefield.manip]).
 â®¥