Skip to content

Instantly share code, notes, and snippets.

@subnut
Created December 14, 2023 19:24
Show Gist options
  • Save subnut/7b2c834c68a31456919ea2f850174339 to your computer and use it in GitHub Desktop.
Save subnut/7b2c834c68a31456919ea2f850174339 to your computer and use it in GitHub Desktop.
template isForwardRangeOf(T) {
bool isForwardRangeOf(R)(R _) if (isForwardRange!(R, T)) => true;
bool isForwardRangeOf(R)(R _) if (!isForwardRange!(R, T)) => false;
}
import std.range.primitives : isForwardRange;
enum bool isForwardRange(R, T)
= std.range.primitives.isForwardRange!R
&& isInputRange!(R, T);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment