2024-10-17 10:08:19 +11:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <ranges>
|
|
|
|
|
2024-10-31 14:18:40 +11:00
|
|
|
namespace cruft::ranges {
|
2024-10-17 10:08:19 +11:00
|
|
|
/// 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)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|