mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
fix trivial constructor declaration
This commit is contained in:
parent
1bce2b4a5b
commit
478c476611
16 changed files with 89 additions and 69 deletions
|
@ -36,7 +36,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR complex(T const& re = T(), T const& im = T()) SPROUT_NOEXCEPT
|
||||
: re_(re), im_(im)
|
||||
{}
|
||||
SPROUT_CONSTEXPR complex(complex const&) = default;
|
||||
complex(complex const&) = default;
|
||||
template<typename X>
|
||||
SPROUT_CONSTEXPR complex(complex<X> const& other) SPROUT_NOEXCEPT
|
||||
: re_(other.real()), im_(other.imag())
|
||||
|
@ -44,66 +44,70 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR T real() const SPROUT_NOEXCEPT {
|
||||
return re_;
|
||||
}
|
||||
void real(T re) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR void real(T re) SPROUT_NOEXCEPT {
|
||||
re_ = re;
|
||||
}
|
||||
SPROUT_CONSTEXPR T imag() const SPROUT_NOEXCEPT {
|
||||
return im_;
|
||||
}
|
||||
void imag(T im) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR void imag(T im) SPROUT_NOEXCEPT {
|
||||
im_ = im;
|
||||
}
|
||||
complex& operator=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ = rhs;
|
||||
im_ = T();
|
||||
return *this;
|
||||
}
|
||||
complex& operator+=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator+=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ += rhs;
|
||||
return *this;
|
||||
}
|
||||
complex& operator-=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator-=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ -= rhs;
|
||||
return *this;
|
||||
}
|
||||
complex& operator*=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator*=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ *= rhs;
|
||||
im_ *= rhs;
|
||||
return *this;
|
||||
}
|
||||
complex& operator/=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator/=(T const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ /= rhs;
|
||||
im_ /= rhs;
|
||||
return *this;
|
||||
}
|
||||
complex& operator=(complex const&) = default;
|
||||
template<typename X>
|
||||
complex& operator=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator=(complex const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ = rhs.real();
|
||||
im_ = rhs.imag();
|
||||
return *this;
|
||||
}
|
||||
template<typename X>
|
||||
complex& operator+=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ = rhs.real();
|
||||
im_ = rhs.imag();
|
||||
return *this;
|
||||
}
|
||||
template<typename X>
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator+=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ += rhs.real();
|
||||
im_ += rhs.imag();
|
||||
return *this;
|
||||
}
|
||||
template<typename X>
|
||||
complex& operator-=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator-=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
re_ -= rhs.real();
|
||||
im_ -= rhs.imag();
|
||||
return *this;
|
||||
}
|
||||
template<typename X>
|
||||
complex& operator*=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator*=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
return *this = complex(
|
||||
re_ * rhs.real() - im_ * rhs.imag(),
|
||||
re_ * rhs.imag() + im_ * rhs.real()
|
||||
);
|
||||
}
|
||||
template<typename X>
|
||||
complex& operator/=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
SPROUT_CXX14_CONSTEXPR complex& operator/=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||
T n = sprout::detail::complex_norm(rhs);
|
||||
return *this = complex(
|
||||
(re_ * rhs.real() + im_ * rhs.imag()) / n,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue