operator<<,>>(std::complex) (3) - Linux Manuals
operator<<,>>(std::complex): operator<<,>>(std::complex)
Command to display operator<<,>>(std::complex)
manual in Linux: $ man 3 operator<<,>>(std::complex)
NAME
operator<<,>>(std::complex) - operator<<,>>(std::complex)
Synopsis
Defined in header <complex>
template <class T, class CharT, class Traits>
std::basic_ostream<CharT, Traits>& (1)
operator<<(std::basic_ostream<CharT, Traits>& os,
const std::complex<T>& x);
template <class T, class CharT, class Traits>
std::basic_istream<CharT, Traits>& (2)
operator>>(std::basic_istream<CharT, Traits>& is,
std::complex<T>& x);
1) Writes to os the complex number in the form (real,imaginary).
2) Reads a complex number from 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)
Exceptions
May throw std::ios_base::failure on stream errors.
Parameters
os - a character output stream
is - a character input stream
x - the complex number to be inserted or extracted
Return value
1) os
2) is
Notes
1) As the comma may be used in the current locale as decimal separator, the output may be ambiguous. This can be solved with std::showpoint which forces the decimal separator to be visible.
2) The input is performed as a series of simple formatted extractions. Whitespace skipping is the same for each of them.
Possible implementation
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();
}
Pages related to operator<<,>>(std::complex)
- operator<<,>>(std::cauchy_distribution) (3) - operator<<,>>(std::cauchy_distribution)
- operator<<,>>(std::chi_squared_distribution) (3) - operator<<,>>(std::chi_squared_distribution)
- operator<<,>>(std::basic_string) (3) - operator<<,>>(std::basic_string)
- operator<<,>>(std::bernoulli_distribution) (3) - operator<<,>>(std::bernoulli_distribution)
- operator<<,>>(std::binomial_distribution) (3) - operator<<,>>(std::binomial_distribution)
- operator<<,>>(std::bitset) (3) - operator<<,>>(std::bitset)
- operator<<,>>(std::discard_block_engine) (3) - operator<<,>>(std::discard_block_engine)
- operator<<,>>(std::discrete_distribution) (3) - operator<<,>>(std::discrete_distribution)
- operator<<,>>(std::experimental::filesystem::path) (3) - operator<<,>>(std::experimental::filesystem::path)
- operator<<,>>(std::exponential_distribution) (3) - operator<<,>>(std::exponential_distribution)
- operator<<,>>(std::extreme_value_distribution) (3) - operator<<,>>(std::extreme_value_distribution)
- operator<<,>>(std::filesystem::path) (3) - operator<<,>>(std::filesystem::path)
- operator<<,>>(std::fisher_f_distribution) (3) - operator<<,>>(std::fisher_f_distribution)
- operator<<,>>(std::gamma_distribution) (3) - operator<<,>>(std::gamma_distribution)
- operator<<,>>(std::geometric_distribution) (3) - operator<<,>>(std::geometric_distribution)
- operator<<,>>(std::independent_bits_engine) (3) - operator<<,>>(std::independent_bits_engine)
- operator<<,>>(std::linear_congruential_engine) (3) - operator<<,>>(std::linear_congruential_engine)
- operator<<,>>(std::lognormal_distribution) (3) - operator<<,>>(std::lognormal_distribution)
- operator<<,>>(std::mersenne_twister_engine) (3) - operator<<,>>(std::mersenne_twister_engine)
- operator<<,>>(std::negative_binomial_distribution) (3) - operator<<,>>(std::negative_binomial_distribution)
- operator<<,>>(std::normal_distribution) (3) - operator<<,>>(std::normal_distribution)
- operator<<,>>(std::piecewise_constant_distribution) (3) - operator<<,>>(std::piecewise_constant_distribution)
- operator<<,>>(std::piecewise_linear_distribution) (3) - operator<<,>>(std::piecewise_linear_distribution)