Boost logo

Ublas :

Subject: Re: [ublas] enable complex @ int
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2009-09-29 10:55:02


namespace boost { namespace numeric { namespace ublas {

      template<typename R> std::complex<R> inline operator+ (int in1,
std::complex<R> const& in2 ) {
        return R (in1) + in2;
      }

      template<typename R> std::complex<R> inline operator+ (std::complex<R>
const& in1, int in2) {
        return in1 + R (in2);
      }

      template<typename R> std::complex<R> inline operator- (int in1,
std::complex<R> const& in2) {
        return R (in1) - in2;
      }

      template<typename R> std::complex<R> inline operator- (std::complex<R>
const& in1, int in2) {
        return in1 - R (in2);
      }

      template<typename R> std::complex<R> inline operator* (int in1,
std::complex<R> const& in2) {
        return R (in1) * in2;
      }

      template<typename R> std::complex<R> inline operator* (std::complex<R>
const& in1, int in2) {
        return in1 * R(in2);
      }

      template<typename R> std::complex<R> inline operator/ (int in1,
std::complex<R> const& in2) {
        return R(in1) / in2;
      }

      template<typename R> std::complex<R> inline operator/ (std::complex<R>
const& in1, int in2) {
        return in1 / R (in2);
      }