| 1 |
/* Copyright (C) 2015 Povilas Kanapickas <[email protected]> |
| 2 |
|
| 3 |
This file is part of cppreference-doc |
| 4 |
|
| 5 |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 |
| 6 |
Unported License. To view a copy of this license, visit |
| 7 |
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative |
| 8 |
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. |
| 9 |
|
| 10 |
Permission is granted to copy, distribute and/or modify this document |
| 11 |
under the terms of the GNU Free Documentation License, Version 1.3 or |
| 12 |
any later version published by the Free Software Foundation; with no |
| 13 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef CPPREFERENCE_COMPLEX_H |
| 17 |
#define CPPREFERENCE_COMPLEX_H |
| 18 |
|
| 19 |
namespace std { |
| 20 |
|
| 21 |
template<class T> |
| 22 |
class complex { |
| 23 |
public: |
| 24 |
typedef T value_type; |
| 25 |
|
| 26 |
complex(const T& re = T(), const T& im = T()); |
| 27 |
|
| 28 |
complex(const complex& other); |
| 29 |
|
| 30 |
template<class X> |
| 31 |
complex(const complex<X>& other); |
| 32 |
|
| 33 |
complex<T>& operator=(const T& x); |
| 34 |
|
| 35 |
template<class X> |
| 36 |
complex<T>& operator=(const complex<X>& cx); |
| 37 |
|
| 38 |
T real() const; |
| 39 |
void real(T value); |
| 40 |
|
| 41 |
T imag() const; |
| 42 |
void imag(T value); |
| 43 |
|
| 44 |
complex<T>& operator+=(const T& other); |
| 45 |
|
| 46 |
template<class X> |
| 47 |
complex<T>& operator+=(const complex<X>& other); |
| 48 |
|
| 49 |
complex<T>& operator-=(const T& other); |
| 50 |
|
| 51 |
template<class X> |
| 52 |
complex<T>& operator-=(const complex<X>& other); |
| 53 |
|
| 54 |
complex<T>& operator*=(const T& other); |
| 55 |
|
| 56 |
template<class X> |
| 57 |
complex<T>& operator*=(const complex<X>& other); |
| 58 |
|
| 59 |
complex<T>& operator/=(const T& other); |
| 60 |
|
| 61 |
template<class X> |
| 62 |
complex<T>& operator/=(const complex<X>& other); |
| 63 |
|
| 64 |
template<class T> |
| 65 |
complex<T> operator+(const complex<T>& val); |
| 66 |
|
| 67 |
template<class T> |
| 68 |
complex<T> operator-(const complex<T>& val); |
| 69 |
}; |
| 70 |
|
| 71 |
template<class T> |
| 72 |
complex<T> operator+(const complex<T>& lhs, const complex<T>& rhs); |
| 73 |
|
| 74 |
template<class T> |
| 75 |
complex<T> operator+(const complex<T>& lhs, const T& rhs); |
| 76 |
|
| 77 |
template<class T> |
| 78 |
complex<T> operator+(const T& lhs, const complex<T>& rhs); |
| 79 |
|
| 80 |
template<class T> |
| 81 |
complex<T> operator-(const complex<T>& lhs, const complex<T>& rhs); |
| 82 |
|
| 83 |
template<class T> |
| 84 |
complex<T> operator-(const complex<T>& lhs, const T& rhs); |
| 85 |
|
| 86 |
template<class T> |
| 87 |
complex<T> operator-(const T& lhs, const complex<T>& rhs); |
| 88 |
|
| 89 |
template<class T> |
| 90 |
complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs); |
| 91 |
|
| 92 |
template<class T> |
| 93 |
complex<T> operator*(const complex<T>& lhs, const T& rhs); |
| 94 |
|
| 95 |
template<class T> |
| 96 |
complex<T> operator*(const T& lhs, const complex<T>& rhs); |
| 97 |
|
| 98 |
template<class T> |
| 99 |
complex<T> operator/(const complex<T>& lhs, const complex<T>& rhs); |
| 100 |
|
| 101 |
template<class T> |
| 102 |
complex<T> operator/(const complex<T>& lhs, const T& rhs); |
| 103 |
|
| 104 |
template<class T> |
| 105 |
complex<T> operator/(const T& lhs, const complex<T>& rhs); |
| 106 |
|
| 107 |
template<class T> |
| 108 |
bool operator==(const complex<T>& lhs, const complex<T>& rhs); |
| 109 |
template<class T> |
| 110 |
bool operator!=(const complex<T>& lhs, const complex<T>& rhs); |
| 111 |
template<class T> |
| 112 |
bool operator<(const complex<T>& lhs, const complex<T>& rhs); |
| 113 |
template<class T> |
| 114 |
bool operator<=(const complex<T>& lhs, const complex<T>& rhs); |
| 115 |
template<class T> |
| 116 |
bool operator>(const complex<T>& lhs, const complex<T>& rhs); |
| 117 |
template<class T> |
| 118 |
bool operator>=(const complex<T>& lhs, const complex<T>& rhs); |
| 119 |
|
| 120 |
template <class T, class CharT, class Traits> |
| 121 |
std::basic_ostream<CharT, Traits>& |
| 122 |
operator<<(std::basic_ostream<CharT, Traits>& os, |
| 123 |
const std::complex<T>& x); |
| 124 |
|
| 125 |
template <class T, class CharT, class Traits> |
| 126 |
std::basic_istream<CharT, Traits>& |
| 127 |
operator>>(std::basic_istream<CharT, Traits>& is, |
| 128 |
std::complex<T>& x); |
| 129 |
|
| 130 |
template<class T> |
| 131 |
T real(const complex<T>& z); |
| 132 |
|
| 133 |
template<class T> |
| 134 |
T imag(const complex<T>& z); |
| 135 |
|
| 136 |
template<class T> |
| 137 |
T abs(const complex<T>& z); |
| 138 |
template<class T> |
| 139 |
T arg(const complex<T>& z); |
| 140 |
template<class T> |
| 141 |
T norm(const complex<T>& z); |
| 142 |
template<class T> |
| 143 |
complex<T> conj(const complex<T>& z); |
| 144 |
template<class T> |
| 145 |
complex<T> proj(const complex<T>& z); |
| 146 |
template<class T> |
| 147 |
complex<T> polar(const T& r, const T& theta = 0); |
| 148 |
template<class T> |
| 149 |
complex<T> exp(const complex<T>& z); |
| 150 |
template<class T> |
| 151 |
complex<T> log(const complex<T>& z); |
| 152 |
template<class T> |
| 153 |
complex<T> log10(const complex<T>& z); |
| 154 |
|
| 155 |
template<class T> |
| 156 |
complex<T> pow(const complex<T>& x, const complex<T>& y); |
| 157 |
template<class T> |
| 158 |
complex<T> pow(const complex<T>& x, const T& y); |
| 159 |
template<class T> |
| 160 |
complex<T> pow(const T& x, const complex<T>& y); |
| 161 |
template<class T> |
| 162 |
complex<T> sqrt(const complex<T>& z); |
| 163 |
|
| 164 |
template<class T> |
| 165 |
complex<T> sin(const complex<T>& z); |
| 166 |
template<class T> |
| 167 |
complex<T> cos(const complex<T>& z); |
| 168 |
template<class T> |
| 169 |
complex<T> tan(const complex<T>& z); |
| 170 |
|
| 171 |
template<class T> |
| 172 |
complex<T> sinh(const complex<T>& z); |
| 173 |
template<class T> |
| 174 |
complex<T> cosh(const complex<T>& z); |
| 175 |
template<class T> |
| 176 |
complex<T> tanh(const complex<T>& z); |
| 177 |
#if CPPREFERENCE_STDVER>= 2011 |
| 178 |
template<class T> |
| 179 |
complex<T> asin(const complex<T>& z); |
| 180 |
template<class T> |
| 181 |
complex<T> acos(const complex<T>& z); |
| 182 |
template<class T> |
| 183 |
complex<T> atan(const complex<T>& z); |
| 184 |
|
| 185 |
template<class T> |
| 186 |
complex<T> asinh(const complex<T>& z); |
| 187 |
template<class T> |
| 188 |
complex<T> acosh(const complex<T>& z); |
| 189 |
template<class T> |
| 190 |
complex<T> atanh(const complex<T>& z); |
| 191 |
|
| 192 |
#endif // CPPREFERENCE_STDVER>= 2011 |
| 193 |
|
| 194 |
} // namespace std |
| 195 |
|
| 196 |
#endif // CPPREFERENCE_COMPLEX_H |