20 lines
441 B
C++
20 lines
441 B
C++
#pragma once
|
|
|
|
#include <ranges>
|
|
|
|
namespace cruft::ranges {
|
|
/// A very simple implementation of std::views::enumerate provided because clang-19 lacks it
|
|
///
|
|
/// clang#19: check me again in clang-20
|
|
template <typename Rng>
|
|
requires (std::ranges::input_range<Rng>)
|
|
auto
|
|
enumerate (Rng &&r)
|
|
{
|
|
return std::views::zip (
|
|
std::views::iota (0),
|
|
std::forward<Rng> (r)
|
|
);
|
|
}
|
|
}
|