Opened 6 years ago

Closed 6 years ago

#873 closed defect (fixed)

skip lvalue requirement in Distance concept

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


This is a subticket of #803, but put here to highlight the difference.

In yat 0.13 Distance concept is documented to work with (const) std::forward_iterator. In terms of boost iterator concepts that translates to

  • readable_iterator
  • forward_traversal
  • lvalue_iterator

where the last point means that operator* returns T& or const T&, i.e., a proxy class cannot be returned. Therefore, Distance classes are not guaranteed to work with e.g. utility::WeightedIterator. This is unwanted and only reason it exists is because we used more coarse-grained iterator concepts in std. I suggest we skip the lvalue requirment on iterators so Distance functionality can work with iterators that return proxy classes as well.

Upside: Proxy iterators can be used with Distance functionality

Downside: If user has its own Distance class and requires lvalue semantic it will not compile against yat 0.14 if we implement the new concept check in functions/classes that take Distance (e.g. classifier::NCC).

Change History (4)

comment:1 Changed 6 years ago by Peter

I forgot to say, this came about because requirements would be more intuitive if we could just say that Distance concept should work on a concept Data Iterator (with stricter requirement on the traversal).

comment:2 Changed 6 years ago by Peter

(In [3540]) refs #871 and #873

comment:3 Changed 6 years ago by Peter

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

comment:4 Changed 6 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [3548]) The concept 'Distance' now requires that operator() works on iterator that are readable and forward traversal, i.e., the previously implicit requirement that iterator's reference type is lvalue is dropped. closes #873

Note: See TracTickets for help on using tickets.