Вопрос

I've gotten used to utilizing the numeric_limits part of the C++ STL for initializing numeric types (int,float, etc.) to their largest possible value. I.e. int i=numeric_limits::max()

Is there an equivalent to this in objective-c? I've seen using INT_MAX and FLT_MAX in google searches, but it seems like there should be a better way.

Это было полезно?

Решение

There is:

NSIntegerMax, NSIntegerMin, CGFLOAT_MAX etc.

These are sufficient for getting the numeric limits.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top