STD::COMPLEX(3)
๐ NAME ๐
std::complex< _Tp > โ the glow-up class template that holds your imaginary bestie right next to your real one ๐ซถ
โจ SYNOPSIS โจ
#include <complex>
๐ธ Public Types ๐ธ
typedef _Tp value_typeโ the value typedef, aka the receipt for what type your numbers actually are ๐
๐ฆ Public Member Functions ๐ฆ
constexpr complex (const _Tp &__r=_Tp(), const _Tp &__i=_Tp())โ the default constructor, bestie. First parameter is x, second parameter is y. Whatever you don't pass in defaults to 0. no cap.constexpr complex (const complex &)=defaultconstexpr complex __rep () consttemplate<typename _Up> explicit (!requires(_Up __u) { _Tp{__u};}) const expr complex(const complex< _Up > &__z)โ the converting constructor ๐constexpr _Tp imag () constconstexpr void imag (_Tp __val)constexpr complex< _Tp > & operator*= (const _Tp &)โ multiply this complex number by a scalar, slay โจtemplate<typename _Up> constexpr complex< _Tp > & operator*= (const complex< _Up > &)โ multiply this complex number by another one ๐ฅconstexpr complex< _Tp > & operator+= (const _Tp &__t)โ add a scalar to this complex number ๐template<typename _Up> constexpr complex< _Tp > & operator+= (const complex< _Up > &)โ add another complex number to this one ๐constexpr complex< _Tp > & operator-= (const _Tp &__t)โ subtract a scalar from this complex number ๐template<typename _Up> constexpr complex< _Tp > & operator-= (const complex< _Up > &)โ subtract another complex number from this one ๐งconstexpr complex< _Tp > & operator/= (const _Tp &)โ divide this complex number by a scalar ๐template<typename _Up> constexpr complex< _Tp > & operator/= (const complex< _Up > &)โ divide this complex number by another ๐constexpr complex< _Tp > & operator= (const _Tp &)โ assign a scalar to this complex number ๐constexpr complex & operator= (const complex &)=defaulttemplate<typename _Up> constexpr complex< _Tp > & operator= (const complex< _Up > &)โ assign another complex number to this one ๐constexpr _Tp real () constconstexpr void real (_Tp __val)
๐ Detailed Description ๐
template<typename _Tp>
class std::complex< _Tp >
Template to represent complex numbers. it's giving math but make it iconic ๐งฎโจ
Specializations for float, double, and long double are part of the library. Results with any other type are not guaranteed โ so like, don't try to be different with your _Tp and then act surprised, bestie ๐ญ
Parameters
- Tp โ Type of real and imaginary values.
๐ Member Typedef Documentation ๐
template<typename _Tp> typedef _Tp std::complex< _Tp >::value_type
Value typedef. that's it, that's the whole vibe ๐
๐ธ Constructor & Destructor Documentation ๐ธ
template<typename _Tp> std::complex< _Tp >::complex (const _Tp & __r =
_Tp(), const _Tp & __i = _Tp()) [inline], [constexpr]
Default constructor. First parameter is x, second parameter is y. Unspecified parameters default to 0. lowkey the easiest way to manifest a complex number ๐ซถ
Referenced by operator*=(), operator*=(), operator+=(), operator-=(), operator/=(), operator/=(), operator=(), and operator=().
โญ Member Function Documentation โญ
template<typename _Tp> template<typename _Up> std::complex< _Tp >::explicit
(!requires(_Up __u) { _Tp{__u};} ) const & [inline]
Converting constructor. she converts, she's flexible, she's main character energy โจ
template<typename _Tp> complex< _Tp > & std::complex< _Tp >::operator*=
(const _Tp & ) [constexpr]
Multiply this complex number by a scalar.
References complex().
template<typename _Tp> template<typename _Up> complex< _Tp > & std::complex<
_Tp >::operator*= (const complex< _Up > & ) [constexpr]
Multiply this complex number by another.
References complex().
template<typename _Tp> complex< _Tp > & std::complex< _Tp >::operator+=
(const _Tp & __t) [inline], [constexpr]
Add a scalar to this complex number. plus one bestie, literally ๐ซถ
template<typename _Tp> template<typename _Up> complex< _Tp > & std::complex<
_Tp >::operator+= (const complex< _Up > & ) [constexpr]
Add another complex number to this one.
References complex().
template<typename _Tp> complex< _Tp > & std::complex< _Tp >::operator-=
(const _Tp & __t) [inline], [constexpr]
Subtract a scalar from this complex number.
template<typename _Tp> template<typename _Up> complex< _Tp > & std::complex<
_Tp >::operator-= (const complex< _Up > & ) [constexpr]
Subtract another complex number from this one.
References complex().
template<typename _Tp> complex< _Tp > & std::complex< _Tp >::operator/=
(const _Tp & ) [constexpr]
Divide this complex number by a scalar.
References complex().
template<typename _Tp> template<typename _Up> complex< _Tp > & std::complex<
_Tp >::operator/= (const complex< _Up > & ) [constexpr]
Divide this complex number by another.
References complex().
template<typename _Tp> complex< _Tp > & std::complex< _Tp >::operator=
(const _Tp & ) [constexpr]
Assign a scalar to this complex number.
References complex().
template<typename _Tp> template<typename _Up> complex< _Tp > & std::complex<
_Tp >::operator= (const complex< _Up > & ) [constexpr]
Assign another complex number to this one.
References complex().
๐ Author ๐
Generated automatically by Doxygen for libstdc++ from the source code. not a human author, just a robot doing her little tasks, and honestly? she ate ๐ฅ
okay that's the whole page bestie, you're officially fluent in std::complex< _Tp > โ this was libstdc++'s version of std::complex< _Tp >(3) and it's giving date night with the compiler, periodt ๐โจ๐ no cap, go forth and be imaginary ๐ฆ
๐ฆ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms