D-Programming-Language/phobos — pull request #1461 by monarchdodra (2013-08-09 20:57:02+00:00)
Title: Fix Issue 10039 - std.algorithm enhancements: min, max, clamp

http://d.puremagic.com/issues/show_bug.cgi?id=10039

This make min and max accept a single argument. Mostly for generic reasons. I doubt anybody would ever explicitly use it.

I also took the opportunity to implement them using a "divide and conquer" scheme. This does not reduce the actual ammount of comparisons, but it does reduce template intantiation depth (you can now do `max(staticIota(0, 5000))`, if that was useful), and more importantly, it also reduces call *depth*, which makes *quite* a performance difference for non `-inline` builds. The more arguments present, the bigger the difference. Makes no observable difference for `-inline` builds when there are less than 7 args. After that though, the difference escalates quickly and exponentially.