diff options
| author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-31 12:14:56 +0000 |
|---|---|---|
| committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-31 12:14:56 +0000 |
| commit | 8878d5e46d4edcc706701f66d12dff79a5f51c0d (patch) | |
| tree | ceaaac0bdc60dd79d70b07301e7aa375cd843bb4 /libstdc++-v3/include/bits/std_complex.h | |
| parent | 9e8f09c322891cc1b2e3c187d3fcb24fe9e432e0 (diff) | |
| download | ppe42-gcc-8878d5e46d4edcc706701f66d12dff79a5f51c0d.tar.gz ppe42-gcc-8878d5e46d4edcc706701f66d12dff79a5f51c0d.zip | |
2001-05-30 Benjamin Kosnik <bkoz@redat.com>
* acconfig.h (_GLIBCPP_BUGGY_FLOAT_COMPLEX): Remove.
(_GLIBCPP_BUGGY_COMPLEX): Remove.
* config.h.in: Regenerate.
* acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT): Remove.
* aclocal.m4: Regenerate.
* configure.in: Don't call it.
* configure: Regenerate.
libstdc++/2970
* src/complex_io.cc (operator<<(ostream&, const complex&): Fix.
* testsuite/26_numerics/complex_inserters_extractors.cc (test01):
New test.
libstdc++/2985
* include/bits/std_complex.h: Include sstream. Put definitions for
complex inserters and extractors here, and remove them from...
* src/complex_io.cc: ...here.
* include/bits/basic_ios.h (basic_ios::__numput_type): Add _Traits
parameter.
(basic_ios::__numget_type): Same.
* include/bits/std_istream.h: Same.
* include/bits/std_ostream.h: Same.
* include/bits/sbuf_iter.h (ostreambuf_iterator): Fix typo in base
class iterator template arguments.
* src/locale-inst.cc: Add explicit has_facet instantiations.
* include/bits/basic_ios.h (basic_ios::_M_get_fctype_ios): Remove.
(_M_get_fnumput): Remove.
(_M_get_fnumget): Remove.
(basic_ios::_M_check_facet): New function.
(basic_ios::_M_cache_facets): New function.
* include/bits/basic_ios.tcc: Definition for _M_cache_facets.
(basic_ios::imbue): Call _M_cache_facets.
(basic_ios::init): Same.
* include/bits/istream.tcc: Format, use _M_check_facet.
* include/bits/ostream.tcc: Same.
* include/bits/locale_facets.tcc (__output_float): Change
signature, add _Traits.
* testsuite/26_numerics/complex_inserters_extractors.cc (test02):
New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42743 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/std_complex.h')
| -rw-r--r-- | libstdc++-v3/include/bits/std_complex.h | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h index 463cd6c06f6..e16a3bd2c80 100644 --- a/libstdc++-v3/include/bits/std_complex.h +++ b/libstdc++-v3/include/bits/std_complex.h @@ -41,11 +41,10 @@ #include <bits/c++config.h> #include <bits/std_cmath.h> -#include <bits/std_iosfwd.h> +#include <bits/std_sstream.h> namespace std { - // Forward declarations template<typename _Tp> class complex; template<> class complex<float>; @@ -346,11 +345,47 @@ namespace std template<typename _Tp, typename _CharT, class _Traits> basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&); + operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) + { + _Tp __re_x, __im_x; + _CharT __ch; + __is >> __ch; + if (__ch == '(') + { + __is >> __re_x >> __ch; + if (__ch == ',') + { + __is >> __im_x >> __ch; + if (__ch == ')') + __x = complex<_Tp>(__re_x, __im_x); + else + __is.setstate(ios_base::failbit); + } + else if (__ch == ')') + __x = complex<_Tp>(__re_x, _Tp(0)); + else + __is.setstate(ios_base::failbit); + } + else + { + __is.putback(__ch); + __is >> __re_x; + __x = complex<_Tp>(__re_x, _Tp(0)); + } + return __is; + } template<typename _Tp, typename _CharT, class _Traits> basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>&, const complex<_Tp>&); + operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) + { + basic_ostringstream<_CharT, _Traits> __s; + __s.flags(__os.flags()); + __s.imbue(__os.getloc()); + __s.precision(__os.precision()); + __s << '(' << __x.real() << "," << __x.imag() << ')'; + return __os << __s.str(); + } // Values template<typename _Tp> |

