Opened 14 years ago

Closed 14 years ago

#604 closed enhancement (fixed)

iterator_traits does not work when data_type is convertible to DataWeight

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


iterator_traits is specialized for case when value_type is DataWeight so iterator is weighted. Iterators that have value_type convertible to DataWeight? should be treated likewise.

Change History (7)

comment:1 Changed 14 years ago by Peter

Status: newassigned

comment:2 Changed 14 years ago by Peter

(In [2159]) fixes #586 and refs #587 extend test of Averager and AveragerWeighted?. Document requirement in iterators.

weighted_iterator_traits<T>::type now returns weighted if T is convertible to DataWeight? (refs #604).

comment:3 Changed 14 years ago by Peter

(In [2164]) improved docs. refs #604

comment:4 Changed 14 years ago by Peter

(In [2165]) complete r2164. refs #604

comment:5 Changed 14 years ago by Peter

The idea is to specialize the template on Iterator::reference having function

double& data(void)

rather than specialize on when Iterator::reference is DataWeight.

Seems like the technique explained here could be used to accomplish this.

comment:6 Changed 14 years ago by Peter

(In [2166]) reimplemented iterator_traits. For unweighted iterators it works as before. For weighted iterators the default implementation is now extended and works as long as *Iter has functions data(void) and weight(void). If these functions return double the corresponding [data|weight]_reference is set to double& and otherwise it is set to const double. This implies that there is no need to have specializations for StrideIterator? or WeightedIterator? so these are removed.

refs #604

comment:7 Changed 14 years ago by Peter

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