Opened 15 years ago

Closed 14 years ago

#17 closed defect (fixed)

constness of views do not work ... or do they?

Reported by: Jari Häkkinen Owned by: Jari Häkkinen
Priority: major Milestone: yat 0.2
Component: gslapi Version: trunk
Keywords: Cc:

Description

In test/matrix_test.cc there is a test that examines what happens when a view is returned from a member function. If the matrixwrapper class interface is changed to setting member function 'row' to const and returning const structures, the constness seems to be ignored. View constness does not apply, i.e. changes to the view will changes the matrix inside the wrapper class. This is maybe expected since in the creation of const views there is a const_cast<> removing constness. What is explanation of this breaking of constness? Could it be that the const view functions (constructors) are not used, but rather the non-const functions (constructors)?

Change History (3)

comment:1 Changed 14 years ago by Jari Häkkinen

Milestone: later0.2

comment:2 Changed 14 years ago by Jari Häkkinen

Status: newassigned

comment:3 Changed 14 years ago by Jari Häkkinen

Resolution: fixed
Status: assignedclosed

Fixes #17. Constness of vectors and views are stricltly maintained. Improper use of const view vectors will cause runtime error. See vector class documentation for more information.

Note: See TracTickets for help on using tickets.