24 Ranges library [ranges]

24.7 Range adaptors [range.adaptors]

24.7.10 Common view [range.common] Overview [range.common.overview]

common_­view takes a View which has different types for its iterator and sentinel and turns it into a View of the same elements with an iterator and sentinel of the same type.
common_­view is useful for calling legacy algorithms that expect a range's iterator and sentinel types to be the same.
end note
// Legacy algorithm:
template<class ForwardIterator>
size_t count(ForwardIterator first, ForwardIterator last);

template<ForwardRange R>
void my_algo(R&& r) {
  auto&& common = common_view{r};
  auto cnt = count(common.begin(), common.end());
  // ...
end example