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)?
  • range.save Freddy via Digitalmars-d
    • Re: range.save Rikki Cattermole via Digitalmars-d
    • Re: range.save Sönke Ludwig via Digitalmars-d
      • Re: range.save Andrei Alexandrescu via Digitalmars-d
        • Re: range.save Sönke Ludwig via Digitalmars-d
          • Re: range.save Jonathan M Davis via Digitalmars-d
          • Re: range.save Andrei Alexandrescu via Digitalmars-d
            • Re: range.... Jonathan M Davis via Digitalmars-d
            • Re: range.... Joseph Rushton Wakeling via Digitalmars-d
              • Re: ra... Jonathan M Davis via Digitalmars-d
                • Re... Joseph Rushton Wakeling via Digitalmars-d
                • Re... Jonathan M Davis via Digitalmars-d
                • Re... Jonathan M Davis via Digitalmars-d
                • Re... Joseph Rushton Wakeling via Digitalmars-d
                • Re... Jonathan M Davis via Digitalmars-d
                • Re... Joseph Rushton Wakeling via Digitalmars-d
                • Re... Jonathan M Davis via Digitalmars-d
                • Re... Joseph Rushton Wakeling via Digitalmars-d
                • Re... Joseph Rushton Wakeling via Digitalmars-d

Reply via email to