Blitz logo

Blitz Devel :

From: Patrick Guio (Patrick.Guio_at_[hidden])
Date: 2005-02-14 07:25:34


On Thu, 10 Feb 2005, Manoj Rajagopalan wrote:

> hi
>
> I'm using g++ 3.4.2 and the compiler complains of not finding the + operator
> for two TinyVector<double, 3> objects. The candidate it lists is
>
> template<typename T> inline operator +(const T&, bz_null_operand)
>
> The hack i had to come up with is to create a new TinyVector<double,3>
> object with one of the two summands in the constructor and to use the +=
> operator to add the other summand.
>
> Does anyone know why this is so?
>
> cheers
> Manoj

Hi,

Did you include the header file for expression templates
(<blitz/tinyvec-et.h>) for TinyVector?
This piece of code compiles well with g++ 3.4.
Sincerely,
Patrick

#include <blitz/tinyvec.h>
#include <blitz/tinyvec-et.h>

int main()
{
   blitz::TinyVector<double, 3> a, b, c;
   c = a + b;
   c += a;
}