operator>>
operator>> >">
template<class E, class T, class A>
basic_istream<E, T>& operator>>(
basic_istream <E, T>& is,
const basic_string<E, T, A>& str);
The template function overloads operator>>
to replace the sequence controlled by str
with a sequence of elements extracted from the stream is
. Extraction stops:
- At end of file.
- After the function extracts
is.
width
()
elements, if that value is nonzero. - After the function extracts
is.
max_size
()
elements. - After the function extracts an element
c
for whichuse_facet
<
ctype
<E> >(
getloc
()).
is
( ctype<E>::
space
, c)
is true, in which case the character is put back.
If the function extracts no elements, it calls setstate
(ios_base::failbit)
. In any case, it calls width(0)
and returns *this
.
See the related sample program.