Skip to content

Improve is_range

Carsten Gräser requested to merge feature/improve-is_range into master

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.

Merge request reports