19 lines
447 B
C++
19 lines
447 B
C++
|
#pragma once
|
||
|
|
||
|
#include <ranges>
|
||
|
|
||
|
|
||
|
namespace cruft::ranges {
|
||
|
/// A convenience function that combines enumerate and zip, such that a preceding index element is returned in
|
||
|
// the result tuple.
|
||
|
template <::std::ranges::viewable_range... Rs>
|
||
|
constexpr ::std::ranges::view auto
|
||
|
izip (Rs &&...rs)
|
||
|
{
|
||
|
return ::std::views::zip (
|
||
|
::std::views::iota (0),
|
||
|
::std::forward<Rs> (rs)...
|
||
|
);
|
||
|
}
|
||
|
}
|