EnumMin, EnumMax

This commit is contained in:
Pavel Kirienko
2015-07-10 17:11:09 +03:00
parent 17aeaf2d0a
commit 37a8562961
@@ -175,6 +175,24 @@ To coerceOrFallback(const From& from)
* @}
*/
/**
* Selects smaller value
*/
template <long A, long B>
struct EnumMin
{
enum { Result = (A < B) ? A : B };
};
/**
* Selects larger value
*/
template <long A, long B>
struct EnumMax
{
enum { Result = (A > B) ? A : B };
};
/**
* Compile time square root for integers.
* Useful for operations on square matrices.