Opened 16 years ago

Closed 16 years ago

#298 closed request (duplicate)

redesign of vector class

Reported by: Peter Owned by: Peter
Priority: critical Milestone:
Component: utility Version:
Keywords: Cc:

Description (last modified by Peter)

Related to ticket:299

Basically merge peter-dev branch into trunk. Though before doing that replace usage of vector with base classes where it is make sense.

Change History (5)

comment:1 Changed 16 years ago by Peter

Description: modified (diff)
Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:2 Changed 16 years ago by Peter

Type: defectrequest

comment:3 Changed 16 years ago by Peter

Description: modified (diff)

comment:4 Changed 16 years ago by Peter

The current design (revision 1006) in peter-dev doesn't work. The problem is that ::iterator is defined as Iterator<double, VectorMutable?> and const_iterator is defined as <const double, const VectorBase?> which implies conversion from iterator to const_iterator is not possible because the current conversion operator only allows const conversion.

One solution would be to implement a specialized constructor for Iterator. Creating a Iterator<const double, const VectorBase?> from a Iterator<double, VectorMutable?>

Another solution would be a bigger redesign, in which we are merging VectorView? and VectorConstView?, and thereby also moving functionality in VectorMutable? up to VectorBase? (and then remove VectorMutable?). How does we prevent a mtable view to be created from a const vector? We cant do that with constructors... so we have to move the interface to functions. In functions we can dictate constness on returntype. This means copying, but it is only a copy of view and I think we can survive that. Also we have to hide the VectorView? constructors to avoid the problem of bad usage. This also means that we have to add some friendship here. In classes offereing VectorView? creation need to friends with VectorView? to see the the private constructors.

comment:5 Changed 16 years ago by Peter

Milestone: 0.4
Resolution: duplicate
Status: assignedclosed

Duplicate of ticket:256

Note: See TracTickets for help on using tickets.