Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::complex::complex(3)      C++ Standard Libary     std::complex::complex(3)

NAME
       std::complex::complex - std::complex::complex

Synopsis
       Primary	template (std::complex<T>) complex( const T& re		(until
       =  T(),	const  T&  im  =	  C++14)  T()  );  constexpr  complex(
       (since  const  T&  re = T(),	      C++14) const T& im = T() ); com-
       plex(   const			     (until    complex&	   other    );
       C++14)  constexpr complex(		   (since const	complex& other
       C++14) );				  (until
					   C++23)      constexpr      complex(
       (since  const  complex&	other		      C++23) ) = default; tem-
       plate<  class  X	  >			     (until   complex(	 const
       C++14)	  complex<X>&	  other	    );	  template<    class	X    >
       (since constexpr	 complex(			   C++14)  const  com-
       plex<X>&					 (until	       other	    );
       C++23)	template<   class    X	  >    constexpr    explicit(/*	   see
       (since  below  */)  complex(			     C++23) const com-
       plex<X>&	other ); Standard explicit specialization  std::complex<float>
       (until  C++23) complex( float re	=				(until
       0.0f, float im =					 C++11)	0.0f );	const-
       expr complex(				    (since float  re  =	 0.0f,
       C++11)	 float	  im	=    0.0f    );	  constexpr   complex(	 const
       (2)    (since complex<float>&					C++20)
       other   )   =   default;	  explicit   complex(  const  complex<double>&
       (until other );							C++11)
       explicit	 complex(  const  complex<long double>&	other ); constexpr ex-
       plicit	  complex(	const	   complex<double>&	 other	    );
       (since  constexpr explicit					C++11)
       complex(	const complex<long double>& other ); Standard explicit	   (1)
       specialization  std::complex<double>  (until C++23)	      (2) com-
       plex(  double  re  =						(until
       0.0,  double im = 0.0						C++11)
       );	      constexpr		    complex(			   (3)
       (since		  double	     re		    =		  0.0,
       C++11)	double	 im   =	   0.0	  );	constexpr    complex(	 const
       (2)			   (since		      complex<double>&
       C++20) other ) =	 default;  complex(  const  complex<float>&  other  );
       (1)				      (until	 explicit     complex(
       C++11) const complex<long double>& other	);  constexpr  complex(	 const
       (3)		  complex<float>&		other		    );
       (since			     constexpr			      explicit
       C++11)  complex(	const complex<long double>& other ); Standard explicit
       specialization  std::complex<long				   (1)
       double>	     (until	  C++23)       complex(	      long	double
       (until		  re		 =	       0.0L,		  long
       C++11)  double  im  =  0.0L );					   (3)
       constexpr	complex(	long	    double	  re	     =
       (since		 0.0L,		  long		  double	    im
       C++11)	=   0.0L   );	constexpr    complex(	 const	  complex<long
       (2)	      (since	     double>&	      other	    )	     =
       C++20)	    default;	   complex(	  const	       complex<float>&
       (1)				 other				    );
       (until			       complex(				 const
       C++11)	  complex<double>&     other	 );	constexpr     complex(
       (3)	    const	   complex<float>&	    other	    );
       (since			     constexpr			      complex(
       C++11) const complex<double>& other );

	  Constructs the std::complex object.
	  The	standard   explicit   specializations	 (std::complex<float>,
       std::complex<double> and
	  std::complex<long  double>)  have different constructor declarations
       from the	main
	  template.
	  (until C++23)

	  1) Constructs	the complex number from	real  part  re	and  imaginary
       part im.
	  2) Copy constructor. Constructs the object with the copy of the con-
       tents of	other.
	  The  copy  constructors  are implicitly declared in the standard ex-
       plicit
	  specializations.
	  (until C++20)
	  3) Converting	constructor. Constructs	the object from	a complex num-
       ber of a
	  different type.

	  The main template provides a converting constructor template,	while
	  each standard	explicit specialization	provides two non-template
	  constructors for the two other standard explicit specializations.
										 (un-
       til C++23)
	  The non-template constructors	are converting constructors (i.e.
	  non-explicit)	if and only if the conversions of the real and	imagi-
       nary
	  parts	are not	narrowing.
	  For the main template, the expression	inside explicit	evaluates to
	  false	 if  and  only	if  the	floating-point conversion rank of T is
       (since C++23)
	  greater than or equal	to the floating-point conversion rank of X.

Parameters
	  re	- the real part
	  im	- the imaginary	part
	  other	- another complex number to use	as source

Notes
	  Since	C++23, the copy	constructor is required	to be trivial in order
       to satisfy the
	  TriviallyCopyable requirement, but implementations generally make it
       trivial in all
	  modes.

See also
	  operator=    assigns the contents
		       (public member function)
	  operator""if
	  operator""i  a std::complex literal  representing  purely  imaginary
       number
	  operator""il (function)
	  (C++14)
	  C documentation for
	  CMPLX

http://cppreference.com		  2024.06.10	      std::complex::complex(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::complex::complex&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help