Opened 16 years ago

Closed 15 years ago

#252 closed defect (fixed)

value is not set properly in Iterator

Reported by: Peter Owned by: Peter
Priority: minor Milestone: yat 0.4
Component: utility Version: trunk
Keywords: Cc:


value should probably reflect the return_type. At time being value is hard-coded as double which is ok now since return_type either is double& or const double. It would have been smoother (more inline with std) if const_iterators could return const double& rather than const double but this is not possible (at least not for Lookups iterators) because underlying containers return double. Actually if underlying container is a Kernel_MEV the double is calculate don on the fly.

Back to my point. value should reflect the returned type. How to do that? If return_type always was a reference one could templatize on value instead and return value&, but that is not the case here. Suggestions?

Change History (7)

comment:1 Changed 16 years ago by Peter

The conversion operator is also hard-coded only allows conversion from double& to const double

comment:2 Changed 16 years ago by Markus Ringnér

Milestone: 0.4

I realize I got confused about similar to this and mentioned it in ticket:247. I am not sure Iterator should be templatized on return_type because value_type is hard-coded to double. Could the reference problems be sorted out if return_type is dropped and one instead makes use of value_type, pointer and reference that have been typedeffed?

comment:3 Changed 16 years ago by Peter

Yes, I think we can drop return_type, and define reference as the type returned from operator* (that is how is used in std, right?). Also, I think we should avoid hard-coding stuff. It doesn't hurt making it generic.

comment:4 Changed 16 years ago by Markus Ringnér

So the template argument should be value_type instead of return_type?

comment:5 Changed 16 years ago by Peter

Yes I think we can remove the return_type. See comment:ticket:255:2

comment:6 Changed 15 years ago by Peter

Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:7 Changed 15 years ago by Peter

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.