Boost logo

Ublas :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-06-02 11:00:10

----- Original Message -----
From: "Michael Stevens" <mail_at_[hidden]>
>> That would definitely explain it and would be consistent the differences
>> are so great between my old Celeron and Stefan's Pentium 4 which have
>> wildly different sized caches.
> I don't believe the differences will be explained by you processors. I
> suspect
> there is something in how you are building the code. Is NDEBUG defined?


>> However, the question then become why would the operators be implemented
>> so
> naively?

> If this is related to the aliasing issue then sadly the answer is that
> finding
> variable alias at compile time is out of the scope of what C++ can easily
> do.
> If you don't like tmp.plus_assign( v) you can use
> noalias(tmp) += v;

How is aliasing an issue for the +=/-= operations? Both should work fine
even if the rhs is an alias for lhs. Is there any reason not to implement +=

vector& operator+=(vector& x) {
  for (int i = size() - 1; i >= 0; --i)
    data[i] +=[i];
  return *this;


Christopher Diggins