On Thursday, 3 December 2015 at 22:14:02 UTC, Justin Whear wrote:
I don't think you want reverse because it works in-place; you'd need to make a copy to compare against. std.range.retro is probably what you're looking for:

bool isPalindrome(R)(R range) if (isBidirectionalRange!R)
{
        return range.equal(range.retro);
}

Obviously this does more work than strictly necessary, but has the brevity you're looking for.

Awesome, and thank you! Clearly I need to learn more about the D type system and std.range, but this is exactly the type of answer is was looking for.

Reply via email to