Opened 6 years ago

Closed 6 years ago

#884 closed defect (fixed)

VectorMutable += incorrect if lhs and rhs overlap

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.14.1
Component: utility Version: trunk
Keywords: Cc:

Description

If lhs and rhs overlap the operation+= may behave unexpectedly as the operation is performed element by element

VectorMutable::operator+=(const VectorBase&)

same problem for operator-=

Change History (4)

comment:1 Changed 6 years ago by Peter

(In [3612]) test for refs #884

comment:2 Changed 6 years ago by Peter

Milestone: yat 0.x+yat 0.14.1
Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:3 Changed 6 years ago by Peter

(In [3616]) merge r3612 to 0.14.x branch. refs #884

comment:4 Changed 6 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [3618]) fixes #884

Element-by-element operations in VectorMutable? such as operator+=, operator-=, mul, and div did not work, when underlying data structure of lhs and rhs overlap such that elements in rhs are affected by the operation on lhs before they have been used on rhs. The fix is to use a temporary Vector when there is risk for overlap.

Note: See TracTickets for help on using tickets.