Boost logo

Ublas :

Subject: Re: [ublas] enable complex @ int
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2009-10-07 19:24:26


Gunter Winkler wrote:

> Am Friday 02 October 2009 schrieb Neal Becker:
>> How do you feel about adding my patch?
>
> good idea: https://svn.boost.org/trac/boost/ticket/3514
>
> We need a somehow general solution like the one suggested by Matwey. But
> we should of course provide a robust solution, too.
>
> Could you please make a short unit test (similar to the nice tests for
> the new free functions)?
>
> mfg
> Gunter
How about:
      template<typename R, typename I>
      typename boost::enable_if<
        mpl::and_<
          boost::is_float<R>,
          boost::is_integral<I>
>,
            std::complex<R> >::type inline operator+ (I in1, std::complex<R> const&
in2 ) {
        return R (in1) + in2;
      }