Skip to content

Instantly share code, notes, and snippets.

@usagi
Created February 2, 2012 18:33
Show Gist options
  • Save usagi/1725014 to your computer and use it in GitHub Desktop.
Save usagi/1725014 to your computer and use it in GitHub Desktop.
C++ std::complex declaration
namespace std {
template<class T>
class complex {
public:
typedef T value_type;
complex(const T& re = T(), const T& im = T());
complex(const complex&);
template<class X> complex(const complex<X>&);
T real() const;
void real(T);
T imag() const;
void imag(T);
complex<T>&
 operator= (const
 T&);
complex<T>&
 operator+=(const
 T&);
complex<T>&
 operator-=(const
 T&);
complex<T>&
 operator*=(const
 T&);
complex<T>&
 operator/=(const
 T&);
complex& operator=(const complex&);
template<class X> complex<T>& operator= (const
 complex<X>&);
template<class X> complex<T>& operator+=(const
 complex<X>&);
template<class X> complex<T>& operator-=(const
 complex<X>&);
template<class X> complex<T>& operator*=(const
 complex<X>&);
template<class X> complex<T>& operator/=(const
 complex<X>&);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment