Defined in header
<complex> | ||
---|---|---|
template <class T, class CharT, class Traits> std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, const std::complex<T>& x); | (1) | |
template <class T, class CharT, class Traits> std::basic_istream<CharT, Traits>& operator>>(std::basic_istream<CharT, Traits>& is, std::complex<T>& x); | (2) |
os
the complex number in the form (real,imaginary)
.is
. The supported formats are real
(real)
(real,imaginary)
Where the input for real
and imaginary
must be convertible to T
. If an error occurs calls is.setstate(ios_base::failbit)
.
May throw std::ios_base::failure
on stream errors.
os | - | a character output stream |
is | - | a character input stream |
x | - | the complex number to be inserted or extracted |
os
is
std::showpoint
which forces the decimal separator to be visible. template<class T, class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& o, const complex<T>& x) { basic_ostringstream<charT, traits> s; s.flags(o.flags()); s.imbue(o.getloc()); s.precision(o.precision()); s << ’(’ << x.real() << "," << x.imag() << ’)’; return o << s.str(); } |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/numeric/complex/operator_ltltgtgt