STD::COMPLEX(3cxx)

πŸ’… std::complex< _Tp > β€” the manual page, but make it cute (3cxx)

Okay bestie, so this is the std::complex< _Tp > page from the libstdc++ manual, section 3cxx β€” the whole complex-numbers situation, the template, all of it. Grab a strawberry πŸ“ and let's go.


✨ NAME ✨

std::complex< _Tp > β€” the template that represents complex numbers, and honestly? iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <complex>

🌸 Public Types 🌸

  • typedef _Tp value_type β€” the Value typedef, i.e. the type that holds your actual real-and-imaginary numbers. πŸ’–

πŸŽ€ Public Member Functions πŸŽ€

  • constexpr complex (const _Tp &__r=_Tp(), const _Tp &__i=_Tp()) β€” the Default constructor. First parameter is x, second parameter is y. Unspecified parameters default to 0. (So like, pick me energy: if you don't pass anything it's just 0 and 0.)
  • constexpr complex (const complex &)=default β€” the copy constructor, defaulted, no notes. ✨
  • template<typename _Up > constexpr complex (const complex< _Up > &__z) β€” the Converting constructor. Glow-up from a different _Up type. πŸ¦‹
  • constexpr complex __rep () const β€” internal representation accessor, literally right there in the list.
  • _GLIBCXX_ABI_TAG_CXX11 constexpr _Tp imag () const β€” gives you the imaginary part back. πŸ’œ
  • constexpr void imag (_Tp __val) β€” sets the imaginary part to __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. Two icons colliding. πŸ”₯
  • 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 &)=default β€” the defaulted copy assignment. Periodt.
  • template<typename _Up > constexpr complex< _Tp > & operator= (const complex< _Up > &) β€” Assign another complex number to this one.
  • _GLIBCXX_ABI_TAG_CXX11 constexpr _Tp real () const β€” gives you the real part back. 🫢
  • constexpr void real (_Tp __val) β€” sets the real part to __val.

πŸ’– Detailed Description πŸ’–

So, template<typename _Tp> ... class std::complex< _Tp > β€” Template to represent complex numbers. That's the whole vibe.

Specializations for float, double, and long double are part of the library. Results with any other type are not guaranteed β€” so like, don't come for the library with some random custom type 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 entry. πŸ’…


✨ Constructor &amp; Destructor Documentation ✨

πŸ’œ template<typename _Tp > constexpr 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. Yes both of them. Lowkey generous. πŸŽ€

πŸ¦‹ template<typename _Tp > template<typename _Up > constexpr std::complex< _Tp >::complex (const complex< _Up > & __z) [inline], [constexpr]

Converting constructor. That's the whole description, no cap.


πŸ”₯ Member Function Documentation πŸ”₯

🌸 template<typename _Tp > constexpr complex< _Tp > & std::complex< _Tp >::operator+= (const _Tp & __t) [inline], [constexpr]

Add a scalar to this complex number. Simple. Effective. Ate.

🌸 template<typename _Tp > constexpr complex< _Tp > & std::complex< _Tp >::operator-= (const _Tp & __t) [inline], [constexpr]

Subtract a scalar from this complex number. Same energy, opposite direction. ✨


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a vibe, just a doc generator doing its thing. πŸ€–


Heads up bestie: that "Results with any other type are not guaranteed" line is the real warning here β€” float, double, and long double are the guaranteed ones, fr fr.

And that's the page! πŸŽ€ This was the std::complex< _Tp >(3cxx) manual entry, shipped under the libstdc++ banner β€” that's the source/version sitch, and the page carries that 3cxx tag. No date on this one, so don't @ me. Byeee! πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from