Boost logo

Ublas :

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


Matwey V. Kornilov wrote:

> Neal Becker wrote:
>
>> I use this patch to traits.hpp:
>>
>> ***************
>> *** 40,45 ****
>> --- 41,81 ----
>>
>> namespace boost { namespace numeric { namespace ublas {
>>
>> + typedef std::complex<double> complex_t;
>> +
>> + inline complex_t operator+ (int in1, complex_t in2) {
>> + return double(in1) + in2;
>> + }
>
> I think it would be better to write in such way:
>
> template<R> std::complex<R> operator+ (int in1, const std::complex<R>& in2
> ){
> return typename std::complex<R>::value_type(in1) + in2;
> }
>
>
That wouldn't conflict with stdlib?