tmp/tmp2g9rk953/{from.md → to.md}
RENAMED
|
@@ -58,30 +58,30 @@ namespace std {
|
|
| 58 |
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
| 59 |
|
| 60 |
template<class T> complex<T> operator+(const complex<T>&);
|
| 61 |
template<class T> complex<T> operator-(const complex<T>&);
|
| 62 |
|
| 63 |
-
template<class T> bool operator==(
|
| 64 |
const complex<T>&, const complex<T>&);
|
| 65 |
-
template<class T> bool operator==(const complex<T>&, const T&);
|
| 66 |
-
template<class T> bool operator==(const T&, const complex<T>&);
|
| 67 |
|
| 68 |
-
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
|
| 69 |
-
template<class T> bool operator!=(const complex<T>&, const T&);
|
| 70 |
-
template<class T> bool operator!=(const T&, const complex<T>&);
|
| 71 |
|
| 72 |
template<class T, class charT, class traits>
|
| 73 |
basic_istream<charT, traits>&
|
| 74 |
operator>>(basic_istream<charT, traits>&, complex<T>&);
|
| 75 |
|
| 76 |
template<class T, class charT, class traits>
|
| 77 |
basic_ostream<charT, traits>&
|
| 78 |
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
|
| 79 |
|
| 80 |
// [complex.value.ops], values:
|
| 81 |
-
template<class T> T real(const complex<T>&);
|
| 82 |
-
template<class T> T imag(const complex<T>&);
|
| 83 |
|
| 84 |
template<class T> T abs(const complex<T>&);
|
| 85 |
template<class T> T arg(const complex<T>&);
|
| 86 |
template<class T> T norm(const complex<T>&);
|
| 87 |
|
|
@@ -111,10 +111,22 @@ namespace std {
|
|
| 111 |
template<class T> complex<T> sin (const complex<T>&);
|
| 112 |
template<class T> complex<T> sinh (const complex<T>&);
|
| 113 |
template<class T> complex<T> sqrt (const complex<T>&);
|
| 114 |
template<class T> complex<T> tan (const complex<T>&);
|
| 115 |
template<class T> complex<T> tanh (const complex<T>&);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
```
|
| 118 |
|
| 119 |
### Class template `complex` <a id="complex">[[complex]]</a>
|
| 120 |
|
|
@@ -123,17 +135,17 @@ namespace std {
|
|
| 123 |
template<class T>
|
| 124 |
class complex {
|
| 125 |
public:
|
| 126 |
typedef T value_type;
|
| 127 |
|
| 128 |
-
complex(const T& re = T(), const T& im = T());
|
| 129 |
-
complex(const complex&);
|
| 130 |
-
template<class X> complex(const complex<X>&);
|
| 131 |
|
| 132 |
-
T real() const;
|
| 133 |
void real(T);
|
| 134 |
-
T imag() const;
|
| 135 |
void imag(T);
|
| 136 |
|
| 137 |
complex<T>& operator= (const T&);
|
| 138 |
complex<T>& operator+=(const T&);
|
| 139 |
complex<T>& operator-=(const T&);
|
|
@@ -160,16 +172,16 @@ namespace std {
|
|
| 160 |
template<> class complex<float> {
|
| 161 |
public:
|
| 162 |
typedef float value_type;
|
| 163 |
|
| 164 |
constexpr complex(float re = 0.0f, float im = 0.0f);
|
| 165 |
-
|
| 166 |
-
|
| 167 |
|
| 168 |
-
constexpr float real();
|
| 169 |
void real(float);
|
| 170 |
-
constexpr float imag();
|
| 171 |
void imag(float);
|
| 172 |
|
| 173 |
complex<float>& operator= (float);
|
| 174 |
complex<float>& operator+=(float);
|
| 175 |
complex<float>& operator-=(float);
|
|
@@ -188,15 +200,15 @@ namespace std {
|
|
| 188 |
public:
|
| 189 |
typedef double value_type;
|
| 190 |
|
| 191 |
constexpr complex(double re = 0.0, double im = 0.0);
|
| 192 |
constexpr complex(const complex<float>&);
|
| 193 |
-
|
| 194 |
|
| 195 |
-
constexpr double real();
|
| 196 |
void real(double);
|
| 197 |
-
constexpr double imag();
|
| 198 |
void imag(double);
|
| 199 |
|
| 200 |
complex<double>& operator= (double);
|
| 201 |
complex<double>& operator+=(double);
|
| 202 |
complex<double>& operator-=(double);
|
|
@@ -217,13 +229,13 @@ namespace std {
|
|
| 217 |
|
| 218 |
constexpr complex(long double re = 0.0L, long double im = 0.0L);
|
| 219 |
constexpr complex(const complex<float>&);
|
| 220 |
constexpr complex(const complex<double>&);
|
| 221 |
|
| 222 |
-
constexpr long double real();
|
| 223 |
void real(long double);
|
| 224 |
-
constexpr long double imag();
|
| 225 |
void imag(long double);
|
| 226 |
|
| 227 |
complex<long double>& operator=(const complex<long double>&);
|
| 228 |
complex<long double>& operator= (long double);
|
| 229 |
complex<long double>& operator+=(long double);
|
|
@@ -241,19 +253,19 @@ namespace std {
|
|
| 241 |
```
|
| 242 |
|
| 243 |
### `complex` member functions <a id="complex.members">[[complex.members]]</a>
|
| 244 |
|
| 245 |
``` cpp
|
| 246 |
-
template<class T> complex(const T& re = T(), const T& im = T());
|
| 247 |
```
|
| 248 |
|
| 249 |
*Effects:* Constructs an object of class `complex`.
|
| 250 |
|
| 251 |
`real() == re && imag() == im`.
|
| 252 |
|
| 253 |
``` cpp
|
| 254 |
-
T real() const;
|
| 255 |
```
|
| 256 |
|
| 257 |
*Returns:* The value of the real component.
|
| 258 |
|
| 259 |
``` cpp
|
|
@@ -261,11 +273,11 @@ void real(T val);
|
|
| 261 |
```
|
| 262 |
|
| 263 |
*Effects:* Assigns `val` to the real component.
|
| 264 |
|
| 265 |
``` cpp
|
| 266 |
-
T imag() const;
|
| 267 |
```
|
| 268 |
|
| 269 |
*Returns:* The value of the imaginary component.
|
| 270 |
|
| 271 |
``` cpp
|
|
@@ -313,38 +325,38 @@ complex<T>& operator/=(const T& rhs);
|
|
| 313 |
and stores the result in `*this`.
|
| 314 |
|
| 315 |
*Returns:* `*this`.
|
| 316 |
|
| 317 |
``` cpp
|
| 318 |
-
complex<T>& operator+=(const complex<
|
| 319 |
```
|
| 320 |
|
| 321 |
*Effects:* Adds the complex value `rhs` to the complex value `*this` and
|
| 322 |
stores the sum in `*this`.
|
| 323 |
|
| 324 |
*Returns:* `*this`.
|
| 325 |
|
| 326 |
``` cpp
|
| 327 |
-
complex<T>& operator-=(const complex<
|
| 328 |
```
|
| 329 |
|
| 330 |
*Effects:* Subtracts the complex value `rhs` from the complex value
|
| 331 |
`*this` and stores the difference in `*this`.
|
| 332 |
|
| 333 |
*Returns:* `*this`.
|
| 334 |
|
| 335 |
``` cpp
|
| 336 |
-
complex<T>& operator*=(const complex<
|
| 337 |
```
|
| 338 |
|
| 339 |
*Effects:* Multiplies the complex value `rhs` by the complex value
|
| 340 |
`*this` and stores the product in `*this`.
|
| 341 |
|
| 342 |
*Returns:* `*this`.
|
| 343 |
|
| 344 |
``` cpp
|
| 345 |
-
complex<T>& operator/=(const complex<
|
| 346 |
```
|
| 347 |
|
| 348 |
*Effects:* Divides the complex value `rhs` into the complex value
|
| 349 |
`*this` and stores the quotient in `*this`.
|
| 350 |
|
|
@@ -404,25 +416,25 @@ template<class T> complex<T> operator/(const T& lhs, const complex<T>& rhs);
|
|
| 404 |
|
| 405 |
*Returns:* `complex<T>(lhs) /= rhs`.
|
| 406 |
|
| 407 |
``` cpp
|
| 408 |
template<class T>
|
| 409 |
-
bool operator==(const complex<T>& lhs, const complex<T>& rhs);
|
| 410 |
-
template<class T> bool operator==(const complex<T>& lhs, const T& rhs);
|
| 411 |
-
template<class T> bool operator==(const T& lhs, const complex<T>& rhs);
|
| 412 |
```
|
| 413 |
|
| 414 |
*Returns:* `lhs.real() == rhs.real() && lhs.imag() == rhs.imag()`.
|
| 415 |
|
| 416 |
*Remarks:* The imaginary part is assumed to be `T()`, or 0.0, for the
|
| 417 |
`T` arguments.
|
| 418 |
|
| 419 |
``` cpp
|
| 420 |
template<class T>
|
| 421 |
-
bool operator!=(const complex<T>& lhs, const complex<T>& rhs);
|
| 422 |
-
template<class T> bool operator!=(const complex<T>& lhs, const T& rhs);
|
| 423 |
-
template<class T> bool operator!=(const T& lhs, const complex<T>& rhs);
|
| 424 |
```
|
| 425 |
|
| 426 |
*Returns:* `rhs.real() != lhs.real() || rhs.imag() != lhs.imag()`.
|
| 427 |
|
| 428 |
``` cpp
|
|
@@ -475,17 +487,17 @@ explicit decimal point character; as a result, all inserted sequences of
|
|
| 475 |
complex numbers can be extracted unambiguously.
|
| 476 |
|
| 477 |
### `complex` value operations <a id="complex.value.ops">[[complex.value.ops]]</a>
|
| 478 |
|
| 479 |
``` cpp
|
| 480 |
-
template<class T> T real(const complex<T>& x);
|
| 481 |
```
|
| 482 |
|
| 483 |
*Returns:* `x.real()`.
|
| 484 |
|
| 485 |
``` cpp
|
| 486 |
-
template<class T> T imag(const complex<T>& x);
|
| 487 |
```
|
| 488 |
|
| 489 |
*Returns:* `x.imag()`.
|
| 490 |
|
| 491 |
``` cpp
|
|
@@ -692,9 +704,38 @@ ensure, for a call with at least one argument of type `complex<T>`:
|
|
| 692 |
or an integer type, then both arguments are effectively cast to
|
| 693 |
`complex<double>`.
|
| 694 |
3. Otherwise, if either argument has type `complex<float>` or `float`,
|
| 695 |
then both arguments are effectively cast to `complex<float>`.
|
| 696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 697 |
### Header `<ccomplex>` <a id="ccmplx">[[ccmplx]]</a>
|
| 698 |
|
| 699 |
The header behaves as if it simply includes the header `<complex>`.
|
| 700 |
|
|
|
|
| 58 |
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
| 59 |
|
| 60 |
template<class T> complex<T> operator+(const complex<T>&);
|
| 61 |
template<class T> complex<T> operator-(const complex<T>&);
|
| 62 |
|
| 63 |
+
template<class T> constexpr bool operator==(
|
| 64 |
const complex<T>&, const complex<T>&);
|
| 65 |
+
template<class T> constexpr bool operator==(const complex<T>&, const T&);
|
| 66 |
+
template<class T> constexpr bool operator==(const T&, const complex<T>&);
|
| 67 |
|
| 68 |
+
template<class T> constexpr bool operator!=(const complex<T>&, const complex<T>&);
|
| 69 |
+
template<class T> constexpr bool operator!=(const complex<T>&, const T&);
|
| 70 |
+
template<class T> constexpr bool operator!=(const T&, const complex<T>&);
|
| 71 |
|
| 72 |
template<class T, class charT, class traits>
|
| 73 |
basic_istream<charT, traits>&
|
| 74 |
operator>>(basic_istream<charT, traits>&, complex<T>&);
|
| 75 |
|
| 76 |
template<class T, class charT, class traits>
|
| 77 |
basic_ostream<charT, traits>&
|
| 78 |
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
|
| 79 |
|
| 80 |
// [complex.value.ops], values:
|
| 81 |
+
template<class T> constexpr T real(const complex<T>&);
|
| 82 |
+
template<class T> constexpr T imag(const complex<T>&);
|
| 83 |
|
| 84 |
template<class T> T abs(const complex<T>&);
|
| 85 |
template<class T> T arg(const complex<T>&);
|
| 86 |
template<class T> T norm(const complex<T>&);
|
| 87 |
|
|
|
|
| 111 |
template<class T> complex<T> sin (const complex<T>&);
|
| 112 |
template<class T> complex<T> sinh (const complex<T>&);
|
| 113 |
template<class T> complex<T> sqrt (const complex<T>&);
|
| 114 |
template<class T> complex<T> tan (const complex<T>&);
|
| 115 |
template<class T> complex<T> tanh (const complex<T>&);
|
| 116 |
+
|
| 117 |
+
// [complex.literals], complex literals:
|
| 118 |
+
inline namespace literals {
|
| 119 |
+
inline namespace complex_literals {
|
| 120 |
+
constexpr complex<long double> operator""il(long double);
|
| 121 |
+
constexpr complex<long double> operator""il(unsigned long long);
|
| 122 |
+
constexpr complex<double> operator""i(long double);
|
| 123 |
+
constexpr complex<double> operator""i(unsigned long long);
|
| 124 |
+
constexpr complex<float> operator""if(long double);
|
| 125 |
+
constexpr complex<float> operator""if(unsigned long long);
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
}
|
| 129 |
```
|
| 130 |
|
| 131 |
### Class template `complex` <a id="complex">[[complex]]</a>
|
| 132 |
|
|
|
|
| 135 |
template<class T>
|
| 136 |
class complex {
|
| 137 |
public:
|
| 138 |
typedef T value_type;
|
| 139 |
|
| 140 |
+
constexpr complex(const T& re = T(), const T& im = T());
|
| 141 |
+
constexpr complex(const complex&);
|
| 142 |
+
template<class X> constexpr complex(const complex<X>&);
|
| 143 |
|
| 144 |
+
constexpr T real() const;
|
| 145 |
void real(T);
|
| 146 |
+
constexpr T imag() const;
|
| 147 |
void imag(T);
|
| 148 |
|
| 149 |
complex<T>& operator= (const T&);
|
| 150 |
complex<T>& operator+=(const T&);
|
| 151 |
complex<T>& operator-=(const T&);
|
|
|
|
| 172 |
template<> class complex<float> {
|
| 173 |
public:
|
| 174 |
typedef float value_type;
|
| 175 |
|
| 176 |
constexpr complex(float re = 0.0f, float im = 0.0f);
|
| 177 |
+
constexpr explicit complex(const complex<double>&);
|
| 178 |
+
constexpr explicit complex(const complex<long double>&);
|
| 179 |
|
| 180 |
+
constexpr float real() const;
|
| 181 |
void real(float);
|
| 182 |
+
constexpr float imag() const;
|
| 183 |
void imag(float);
|
| 184 |
|
| 185 |
complex<float>& operator= (float);
|
| 186 |
complex<float>& operator+=(float);
|
| 187 |
complex<float>& operator-=(float);
|
|
|
|
| 200 |
public:
|
| 201 |
typedef double value_type;
|
| 202 |
|
| 203 |
constexpr complex(double re = 0.0, double im = 0.0);
|
| 204 |
constexpr complex(const complex<float>&);
|
| 205 |
+
constexpr explicit complex(const complex<long double>&);
|
| 206 |
|
| 207 |
+
constexpr double real() const;
|
| 208 |
void real(double);
|
| 209 |
+
constexpr double imag() const;
|
| 210 |
void imag(double);
|
| 211 |
|
| 212 |
complex<double>& operator= (double);
|
| 213 |
complex<double>& operator+=(double);
|
| 214 |
complex<double>& operator-=(double);
|
|
|
|
| 229 |
|
| 230 |
constexpr complex(long double re = 0.0L, long double im = 0.0L);
|
| 231 |
constexpr complex(const complex<float>&);
|
| 232 |
constexpr complex(const complex<double>&);
|
| 233 |
|
| 234 |
+
constexpr long double real() const;
|
| 235 |
void real(long double);
|
| 236 |
+
constexpr long double imag() const;
|
| 237 |
void imag(long double);
|
| 238 |
|
| 239 |
complex<long double>& operator=(const complex<long double>&);
|
| 240 |
complex<long double>& operator= (long double);
|
| 241 |
complex<long double>& operator+=(long double);
|
|
|
|
| 253 |
```
|
| 254 |
|
| 255 |
### `complex` member functions <a id="complex.members">[[complex.members]]</a>
|
| 256 |
|
| 257 |
``` cpp
|
| 258 |
+
template<class T> constexpr complex(const T& re = T(), const T& im = T());
|
| 259 |
```
|
| 260 |
|
| 261 |
*Effects:* Constructs an object of class `complex`.
|
| 262 |
|
| 263 |
`real() == re && imag() == im`.
|
| 264 |
|
| 265 |
``` cpp
|
| 266 |
+
constexpr T real() const;
|
| 267 |
```
|
| 268 |
|
| 269 |
*Returns:* The value of the real component.
|
| 270 |
|
| 271 |
``` cpp
|
|
|
|
| 273 |
```
|
| 274 |
|
| 275 |
*Effects:* Assigns `val` to the real component.
|
| 276 |
|
| 277 |
``` cpp
|
| 278 |
+
constexpr T imag() const;
|
| 279 |
```
|
| 280 |
|
| 281 |
*Returns:* The value of the imaginary component.
|
| 282 |
|
| 283 |
``` cpp
|
|
|
|
| 325 |
and stores the result in `*this`.
|
| 326 |
|
| 327 |
*Returns:* `*this`.
|
| 328 |
|
| 329 |
``` cpp
|
| 330 |
+
template<class X> complex<T>& operator+=(const complex<X>& rhs);
|
| 331 |
```
|
| 332 |
|
| 333 |
*Effects:* Adds the complex value `rhs` to the complex value `*this` and
|
| 334 |
stores the sum in `*this`.
|
| 335 |
|
| 336 |
*Returns:* `*this`.
|
| 337 |
|
| 338 |
``` cpp
|
| 339 |
+
template<class X> complex<T>& operator-=(const complex<X>& rhs);
|
| 340 |
```
|
| 341 |
|
| 342 |
*Effects:* Subtracts the complex value `rhs` from the complex value
|
| 343 |
`*this` and stores the difference in `*this`.
|
| 344 |
|
| 345 |
*Returns:* `*this`.
|
| 346 |
|
| 347 |
``` cpp
|
| 348 |
+
template<class X> complex<T>& operator*=(const complex<X>& rhs);
|
| 349 |
```
|
| 350 |
|
| 351 |
*Effects:* Multiplies the complex value `rhs` by the complex value
|
| 352 |
`*this` and stores the product in `*this`.
|
| 353 |
|
| 354 |
*Returns:* `*this`.
|
| 355 |
|
| 356 |
``` cpp
|
| 357 |
+
template<class X> complex<T>& operator/=(const complex<X>& rhs);
|
| 358 |
```
|
| 359 |
|
| 360 |
*Effects:* Divides the complex value `rhs` into the complex value
|
| 361 |
`*this` and stores the quotient in `*this`.
|
| 362 |
|
|
|
|
| 416 |
|
| 417 |
*Returns:* `complex<T>(lhs) /= rhs`.
|
| 418 |
|
| 419 |
``` cpp
|
| 420 |
template<class T>
|
| 421 |
+
constexpr bool operator==(const complex<T>& lhs, const complex<T>& rhs);
|
| 422 |
+
template<class T> constexpr bool operator==(const complex<T>& lhs, const T& rhs);
|
| 423 |
+
template<class T> constexpr bool operator==(const T& lhs, const complex<T>& rhs);
|
| 424 |
```
|
| 425 |
|
| 426 |
*Returns:* `lhs.real() == rhs.real() && lhs.imag() == rhs.imag()`.
|
| 427 |
|
| 428 |
*Remarks:* The imaginary part is assumed to be `T()`, or 0.0, for the
|
| 429 |
`T` arguments.
|
| 430 |
|
| 431 |
``` cpp
|
| 432 |
template<class T>
|
| 433 |
+
constexpr bool operator!=(const complex<T>& lhs, const complex<T>& rhs);
|
| 434 |
+
template<class T> constexpr bool operator!=(const complex<T>& lhs, const T& rhs);
|
| 435 |
+
template<class T> constexpr bool operator!=(const T& lhs, const complex<T>& rhs);
|
| 436 |
```
|
| 437 |
|
| 438 |
*Returns:* `rhs.real() != lhs.real() || rhs.imag() != lhs.imag()`.
|
| 439 |
|
| 440 |
``` cpp
|
|
|
|
| 487 |
complex numbers can be extracted unambiguously.
|
| 488 |
|
| 489 |
### `complex` value operations <a id="complex.value.ops">[[complex.value.ops]]</a>
|
| 490 |
|
| 491 |
``` cpp
|
| 492 |
+
template<class T> constexpr T real(const complex<T>& x);
|
| 493 |
```
|
| 494 |
|
| 495 |
*Returns:* `x.real()`.
|
| 496 |
|
| 497 |
``` cpp
|
| 498 |
+
template<class T> constexpr T imag(const complex<T>& x);
|
| 499 |
```
|
| 500 |
|
| 501 |
*Returns:* `x.imag()`.
|
| 502 |
|
| 503 |
``` cpp
|
|
|
|
| 704 |
or an integer type, then both arguments are effectively cast to
|
| 705 |
`complex<double>`.
|
| 706 |
3. Otherwise, if either argument has type `complex<float>` or `float`,
|
| 707 |
then both arguments are effectively cast to `complex<float>`.
|
| 708 |
|
| 709 |
+
### Suffixes for complex number literals <a id="complex.literals">[[complex.literals]]</a>
|
| 710 |
+
|
| 711 |
+
This section describes literal suffixes for constructing complex number
|
| 712 |
+
literals. The suffixes `i`, `il`, and `if` create complex numbers of the
|
| 713 |
+
types `complex<double>`, `complex<long double>`, and `complex<float>`
|
| 714 |
+
respectively, with their imaginary part denoted by the given literal
|
| 715 |
+
number and the real part being zero.
|
| 716 |
+
|
| 717 |
+
``` cpp
|
| 718 |
+
constexpr complex<long double> operator""il(long double d);
|
| 719 |
+
constexpr complex<long double> operator""il(unsigned long long d);
|
| 720 |
+
```
|
| 721 |
+
|
| 722 |
+
*Returns:* `complex<long double>{0.0L, static_cast<long double>(d)}`.
|
| 723 |
+
|
| 724 |
+
``` cpp
|
| 725 |
+
constexpr complex<double> operator""i(long double d);
|
| 726 |
+
constexpr complex<double> operator""i(unsigned long long d);
|
| 727 |
+
```
|
| 728 |
+
|
| 729 |
+
*Returns:* `complex<double>{0.0, static_cast<double>(d)}`.
|
| 730 |
+
|
| 731 |
+
``` cpp
|
| 732 |
+
constexpr complex<float> operator""if(long double d);
|
| 733 |
+
constexpr complex<float> operator""if(unsigned long long d);
|
| 734 |
+
```
|
| 735 |
+
|
| 736 |
+
*Returns:* `complex<float>{0.0f, static_cast<float>(d)}`.
|
| 737 |
+
|
| 738 |
### Header `<ccomplex>` <a id="ccmplx">[[ccmplx]]</a>
|
| 739 |
|
| 740 |
The header behaves as if it simply includes the header `<complex>`.
|
| 741 |
|