Jim Barnett via Digitalmars-d-learn digitalmars-d-learn at
Thu Dec 3 14:42:20 PST 2015

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.

More information about the Digitalmars-d-learn mailing list