On 28/12/2012 13:38, Phil Lavoie wrote:
Hi,
Sorry for the duplicate the forum did not seem to have processed my post
so I made another one. I'm sorry I didn't mean TYPE INFERENCE did not
work I meant that this:
int x
uint y;
min( x, y ) will not compile, you would have to rewrite it to min( x,
cast( int )y ) for example, or min!int( x, y ).
You can't reliably compare signed and unsigned versions of the same type
even under C, and D has the same problem
http://d.puremagic.com/issues/show_bug.cgi?id=259
http://d.puremagic.com/issues/show_bug.cgi?id=2205
So, while it would be trivial (and even a more faithful translation of
the C macro) to change it to templatise the two parameters separately,
it's probably for the better that it hasn't been done this way.
I am just saying that
there is an implementation in std.algorithm that work right out of the
box without such explicitness. In addition, it works with a variable
amount of params ( z = min( a, b, c, d, e, ..., y ) ), so I am just
saying either we solicit the use of that one or implement it for two
parameters :).
If std.algorithm.min always gives the correct result, then you're free
to use that. OTOH, those who don't need the extra power of the stuff in
std.algorithm are free to use the one in the Windows bindings.
Stewart.