79236829

Date: 2024-11-29 11:02:53
Score: 0.5
Natty:
Report link

No, borrowed_range does not imply view, for example, std::ranges::owning_view is not a borrowed range as the life time of elements is tied to the life time of the view.

#include <ranges>
#include <vector>

int main() {
    std::vector vec{1,2,3};
    std::ranges::owning_view s(std::move(vec));
    static_assert(!std::ranges::borrowed_range<decltype(s)>);
}

I'm still not sure if there is any other view that is not a std::ranges::borrowed_range

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: dwto