Skip to content

Merge branch 'feature/improve-is_range' into 'master'

Ansgar Burchardt requested to merge cherry-pick-a6527917 into releases/2.5

Improve is_range

This avoids the sizeof hack in favour of a more idiomatic version and also implements checks for all needed expressions:

  • existenz of r.begin()
  • existenz of r.end()
  • inequality comparison of iterator and end-iterator
  • end-iterator converts to iterator (dropped in C++17)
  • prefix increment of iterator
  • dereference of iterator

In order to avoid a "computed value not used warning" we add an additional call to a dummy function.

In fact this check is not complete, because it only accepts member begin() and end(). Adding support for std:: and adl-version would require a more complicated helper and thus better be placed in a real concept definition.

See merge request !187 (merged)

Merge request reports