On Thursday, 26 November 2015 at 17:23:07 UTC, Andrei
Alexandrescu wrote:
So initially I thought a simple solution would be this:
struct MyForwardRange
{
enum bool isForward = true;
... empty, front, popFront ...
}
enum isForwardRange(R) =
is(typeof(R.isForward)) && R.isForward;
Then there's no need for .save(), and isForward!R can be used
for constraints etc. Reference forward ranges are not supported
but then that's liberating (fewer complications), rare, and
easy to work around by wrapping.
By "reference forward range" do you mean a reference type (per
se) or any range that contains an internal reference type (e.g. a
range whose private data includes a dynamic array)?