template <unsigned int b, unsigned int n>
struct log
{
enum { value = log<b, n / b>::value + 1 };
};
template <unsigned int b>
struct log<b, 1>
{
enum { value = 0 };
};
Show differencesHistory of post edits
#ActualÁlvaro
Posted 11 January 2013 - 09:52 AM
How's this?
#1Álvaro
Posted 11 January 2013 - 09:52 AM
How's this?
template <unsigned int b, unsigned int n>
struct log
{
enum { value = log<b, n / b>::value + 1 };
};
template <unsigned int b>
struct log<b, 1>
{
enum { value = 0 };
};