D-Programming-Language/phobos — pull request #1074 by monarchdodra (2013-01-15 15:10:25+00:00)
Title:  Issue 9314 - std.algorithm.minCount of const(int)[]

First, makes a static check that it is actually possible to return the result. There are certain types that can't be placed in a Tuple. This is statically asserted and explained internally.

----
Fix: If the input range is a forward range, then the algorithm is pretty straightforward.

Things start getting hairy if the range is just input. The algorithm tries to make a copy of the smallest element, while respecting const correctness. If not possible, there is a "potential" fork for trying it with Lvalues. Finally, there is a "I give up static assert".

To be quite frank, If you can place it in a tuple, it will be assignable*, so the "Lvalue" for branch or the "I give" up branch are mostly useless. It's just me covering my ass.

*Except if you write a struct with a "opAssign() immutable". This is completely retarded though, so I'm not worried..