[EMAIL PROTECTED] writes: > What I did is I implemented template fn bool isnegative() which is used > instead of <0. > This fn returns false in general and is specialized for signed types so > that it returns <0.
In GNU C I'd use #define isnegative(i) \ ((__typeof__(i))-1 < 1 && (i) < (__typeof__(i)) ((__typeof__(i))-1 > 0)) For unsigned types it becomes (false && ...skipped...) For signed types, (true && (i) < (__typeof__(i))false). Possibly the (__typeof(i)__) cast can be skipped without provoking any warnings, I'm not sure. Maybe there is a C++ way to do something similar, without using a Gnu extension. -- Hallvard _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus