const debacle

Craig Black cblack at ara.com
Mon Mar 24 12:09:27 PDT 2008


> T min(T)(T firstval, T secondval)
> {
>  return firstval < secondval ? firstval : secondval;
> }
>
> This should have const on firstval and secondval, even if T is a mutable 
> type, but because of the current const rules, it can't.

I must have missed something.  What's wrong with this:

T min(T)(const T a, const T b) { return a < b ? a : b; } 





More information about the Digitalmars-d mailing list