STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Macros | Typedefs | Functions | Variables
complex File Reference
#include <ymath.h>
#include <ccomplex>
#include <cmath>
#include <sstream>
#include <xcomplex>

Classes

struct  _C_double_complex
 
struct  _C_float_complex
 
struct  _C_ldouble_complex
 
class  complex< _Ty >
 
class  _Ctraits< _Ty >
 
class  _Ctraits< long double >
 
class  _Ctraits< double >
 
class  _Ctraits< float >
 
struct  _Complex_value< _Ty >
 
class  _Complex_base< _Ty, _Valbase >
 
class  complex< float >
 
class  complex< double >
 
class  complex< long double >
 
class  complex< _Ty >
 

Macros

#define _COMPLEX_
 
#define _C_COMPLEX_T
 
#define _RE   0
 
#define _IM   1
 
#define _CMPLX(T)   complex<T >
 
#define _CTR(T)   _Ctraits<T >
 
#define _TMPLT(T)   template<class T >
 

Typedefs

typedef struct _C_double_complex _C_double_complex
 
typedef struct _C_float_complex _C_float_complex
 
typedef struct _C_ldouble_complex _C_ldouble_complex
 
typedef _CSTD _C_float_complex _Fcomplex_value
 
typedef _CSTD _C_ldouble_complex _Lcomplex_value
 

Functions

template<class _Ty , class _Elem , class _Tr >
basic_istream< _Elem, _Tr > & operator>> (basic_istream< _Elem, _Tr > &_Istr, complex< _Ty > &_Right)
 
template<class _Ty , class _Elem , class _Tr >
basic_ostream< _Elem, _Tr > & operator<< (basic_ostream< _Elem, _Tr > &_Ostr, const complex< _Ty > &_Right)
 

Variables

_STD_BEGIN typedef _CSTD _C_double_complex _Dcomplex_value
 

Macro Definition Documentation

#define _C_COMPLEX_T
#define _CMPLX (   T)    complex<T >
#define _COMPLEX_
#define _CTR (   T)    _Ctraits<T >
#define _IM   1
#define _RE   0
#define _TMPLT (   T)    template<class T >

Typedef Documentation

Function Documentation

template<class _Ty , class _Elem , class _Tr >
basic_ostream<_Elem, _Tr>& operator<< ( basic_ostream< _Elem, _Tr > &  _Ostr,
const complex< _Ty > &  _Right 
)
inline
1298  { // insert a complex<_Ty>
1299  const ctype<_Elem>& _Ctype_fac = _USE(_Ostr.getloc(), ctype<_Elem>);
1301 
1302  _Sstr.flags(_Ostr.flags());
1303  _Sstr.imbue(_Ostr.getloc());
1304  _Sstr.precision(_Ostr.precision());
1305  _Sstr << _Ctype_fac.widen('(') << real(_Right)
1306  << _Ctype_fac.widen(',') << imag(_Right)
1307  << _Ctype_fac.widen(')');
1308 
1309  basic_string<_Elem, _Tr, allocator<_Elem> > _Str = _Sstr.str();
1310  return (_Ostr << _Str.c_str());
1311  }
#define _USE(loc, fac)
Definition: xlocale:555
_Tmp imag(_Tmp.imag()*_Right)
streamsize __CLR_OR_THIS_CALL precision() const
Definition: xiosbase:398
Definition: iosfwd:645
const _Elem * c_str() const _NOEXCEPT
Definition: xstring:1737
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
fmtflags __CLR_OR_THIS_CALL flags() const
Definition: xiosbase:365
_Tmp real(_Tmp.real()+_Right)
Definition: xlocale:2113
_Elem __CLR_OR_THIS_CALL widen(char _Byte) const
Definition: xlocale:2162
Definition: xstring:21
template<class _Ty , class _Elem , class _Tr >
basic_istream<_Elem, _Tr>& operator>> ( basic_istream< _Elem, _Tr > &  _Istr,
complex< _Ty > &  _Right 
)
inline
1257  { // extract a complex<_Ty>
1258  typedef complex<_Ty> _Myt;
1259  const ctype<_Elem>& _Ctype_fac = _USE(_Istr.getloc(), ctype<_Elem>);
1260  _Elem _Ch = 0;
1261  long double _Real = 0;
1262  long double _Imag = 0;
1263 
1264  if (_Istr >> _Ch && _Ch != _Ctype_fac.widen('('))
1265  { // no leading '(', treat as real only
1266  _Istr.putback(_Ch);
1267  _Istr >> _Real;
1268  _Imag = 0;
1269  }
1270  else if (_Istr >> _Real >> _Ch && _Ch != _Ctype_fac.widen(','))
1271  if (_Ch == _Ctype_fac.widen(')'))
1272  _Imag = 0; // (real)
1273  else
1274  { // no trailing ')' after real, treat as bad field
1275  _Istr.putback(_Ch);
1276  _Istr.setstate(ios_base::failbit);
1277  }
1278  else if (_Istr >> _Imag >> _Ch && _Ch != _Ctype_fac.widen(')'))
1279  { // no imag or trailing ')', treat as bad field
1280  _Istr.putback(_Ch);
1281  _Istr.setstate(ios_base::failbit);
1282  }
1283 
1284  if (!_Istr.fail())
1285  { // store valid result
1286  _Ty _Tyreal((_Ty)_Real), _Tyimag((_Ty)_Imag);
1287  _Right = _Myt(_Tyreal, _Tyimag);
1288  }
1289  return (_Istr);
1290  }
Definition: complex:49
static const _Iostate failbit
Definition: xiosbase:89
#define _USE(loc, fac)
Definition: xlocale:555
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
Definition: xlocale:2113
_Myt &__CLR_OR_THIS_CALL putback(_Elem _Ch)
Definition: istream:788
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
_Elem __CLR_OR_THIS_CALL widen(char _Byte) const
Definition: xlocale:2162
bool __CLR_OR_THIS_CALL fail() const
Definition: xiosbase:338
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54

Variable Documentation

_STD_BEGIN typedef _CSTD _C_double_complex _Dcomplex_value