Loading ...
Sorry, an error occurred while loading the content.

Re: [ublas-dev] Re: unwanted insertion of explicit zeros again

Expand Messages
  • jhr.walter@t-online.de
    Hi, ... Yes. ... [snip] ... Here viter may or may not be invalidated depending on the storage type. ... This behaviour probably should be documented. Thanks,
    Message 1 of 6 , Dec 8, 2003
    • 0 Attachment
      Hi,

      > > From reading your initial posting it seems there were two related
      > > problems. Firstly incorrect evalution of the expression
      > > v1(1) = v1(1) - v1(0);
      > > due to reference invalidation
      > > And secondly the insertion of the explicit zero.
      >
      > Right. I would like to stress that the invalidation problem is not
      > fixed.

      Yes.

      > I modified my initial code sample to demonstrate that.
      > The code creates a vector v= [ 0 1 2 ], and then creates an iterator
      > dviter pointing to v.begin() = v(1) = "1". Then I calculate
      > v(0) = v(0) + 42*v(1), so the previously implicit zero value v(0) is
      > set to "42". Unfortunately, the iterator isn't updated and still
      > points to v.begin(), which is now v(0) instead of v(1).

      [snip]

      > VECTOR::iterator viter = v.begin();
      > cout<<*viter<<endl;
      > v(0) = v(0) + 42*v(1);

      Here viter may or may not be invalidated depending on the storage type.

      > cout<<*dviter<<endl; //should yield "1"
      > ++viter;
      > cout<<*viter<<endl; //should yield "2"
      >
      > return EXIT_SUCCESS;
      > };

      This behaviour probably should be documented.

      Thanks,
      Joerg
    Your message has been successfully submitted and would be delivered to recipients shortly.