forked from p12tic/cppreference-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplex
More file actions
247 lines (194 loc) · 6.42 KB
/
complex
File metadata and controls
247 lines (194 loc) · 6.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/* Copyright (C) 2015 Povilas Kanapickas <povilas@radix.lt>
This file is part of cppreference-doc
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
Unported License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
*/
#ifndef CPPREFERENCE_COMPLEX_H
#define CPPREFERENCE_COMPLEX_H
#include <iosfwd>
namespace std {
template<class T>
class complex {
public:
typedef T value_type;
#if CPPREFERENCE_STDVER >= 2014
constexpr complex(const T& re = T(), const T& im = T());
constexpr complex(const complex& other);
template<class X>
constexpr complex(const complex<X>& other);
#else
complex(const T& re = T(), const T& im = T());
complex(const complex& other);
template<class X>
complex(const complex<X>& other);
#endif
complex<T>& operator=(const T& x);
template<class X>
complex<T>& operator=(const complex<X>& cx);
#if CPPREFERENCE_STDVER >= 2014
constexpr T real() const;
#else
T real() const;
#endif
#if CPPREFERENCE_STDVER >= 2020
constexpr void real(T value);
#else
void real(T value);
#endif
#if CPPREFERENCE_STDVER >= 2014
constexpr T imag() const;
#else
T imag() const;
#endif
#if CPPREFERENCE_STDVER >= 2020
constexpr void imag(T value);
#else
void imag(T value);
#endif
complex<T>& operator+=(const T& other);
template<class X>
complex<T>& operator+=(const complex<X>& other);
complex<T>& operator-=(const T& other);
template<class X>
complex<T>& operator-=(const complex<X>& other);
complex<T>& operator*=(const T& other);
template<class X>
complex<T>& operator*=(const complex<X>& other);
complex<T>& operator/=(const T& other);
template<class X>
complex<T>& operator/=(const complex<X>& other);
template<class X>
complex<T> operator+(const complex<X>& val);
template<class X>
complex<T> operator-(const complex<X>& val);
};
template<class T>
complex<T> operator+(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator+(const complex<T>& lhs, const T& rhs);
template<class T>
complex<T> operator+(const T& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator-(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator-(const complex<T>& lhs, const T& rhs);
template<class T>
complex<T> operator-(const T& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator*(const complex<T>& lhs, const T& rhs);
template<class T>
complex<T> operator*(const T& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator/(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
complex<T> operator/(const complex<T>& lhs, const T& rhs);
template<class T>
complex<T> operator/(const T& lhs, const complex<T>& rhs);
#if CPPREFERENCE_STDVER >= 2014
template<class T>
constexpr bool operator==(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
constexpr bool operator!=(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
constexpr bool operator<(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
constexpr bool operator<=(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
constexpr bool operator>(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
constexpr bool operator>=(const complex<T>& lhs, const complex<T>& rhs);
#else
template<class T>
bool operator==(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
bool operator!=(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
bool operator<(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
bool operator<=(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
bool operator>(const complex<T>& lhs, const complex<T>& rhs);
template<class T>
bool operator>=(const complex<T>& lhs, const complex<T>& rhs);
#endif
template <class T, class CharT, class Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
const std::complex<T>& x);
template <class T, class CharT, class Traits>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is,
std::complex<T>& x);
#if CPPREFERENCE_STDVER >= 2014
template<class T>
constexpr T real(const complex<T>& z);
template<class T>
constexpr T imag(const complex<T>& z);
#else
template<class T>
T real(const complex<T>& z);
template<class T>
T imag(const complex<T>& z);
#endif
template<class T>
T abs(const complex<T>& z);
template<class T>
T arg(const complex<T>& z);
template<class T>
T norm(const complex<T>& z);
template<class T>
complex<T> conj(const complex<T>& z);
template<class T>
complex<T> proj(const complex<T>& z);
template<class T>
complex<T> polar(const T& r, const T& theta = 0);
template<class T>
complex<T> exp(const complex<T>& z);
template<class T>
complex<T> log(const complex<T>& z);
template<class T>
complex<T> log10(const complex<T>& z);
template<class T>
complex<T> pow(const complex<T>& x, const complex<T>& y);
template<class T>
complex<T> pow(const complex<T>& x, const T& y);
template<class T>
complex<T> pow(const T& x, const complex<T>& y);
template<class T>
complex<T> sqrt(const complex<T>& z);
template<class T>
complex<T> sin(const complex<T>& z);
template<class T>
complex<T> cos(const complex<T>& z);
template<class T>
complex<T> tan(const complex<T>& z);
template<class T>
complex<T> sinh(const complex<T>& z);
template<class T>
complex<T> cosh(const complex<T>& z);
template<class T>
complex<T> tanh(const complex<T>& z);
#if CPPREFERENCE_STDVER>= 2011
template<class T>
complex<T> asin(const complex<T>& z);
template<class T>
complex<T> acos(const complex<T>& z);
template<class T>
complex<T> atan(const complex<T>& z);
template<class T>
complex<T> asinh(const complex<T>& z);
template<class T>
complex<T> acosh(const complex<T>& z);
template<class T>
complex<T> atanh(const complex<T>& z);
#endif // CPPREFERENCE_STDVER>= 2011
} // namespace std
#endif // CPPREFERENCE_COMPLEX_H