https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96704

            Bug ID: 96704
           Summary: begin() and end() iterators of views::values_view have
                    different type
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gleb at scylladb dot com
  Target Milestone: ---

The following program fail on the second assert.

#include <ranges>
#include <unordered_map>

int main() {
  std::unordered_map<int, int> x;
  auto r = std::views::values(x);
  static_assert(std::is_same_v<decltype(x.begin()), decltype(x.end())>);
  static_assert(std::is_same_v<decltype(r.begin()), decltype(r.end())>);
}

It means functions like:

template<typename I> foo(I it1, I it2);

cannot be called with:

foo(r.begin(), r.end());

Reply via email to