// C++03
static const int radix;
// C++11
static constexpr int radix;
概要
digits
を表現する基数を示す
例
#include <iostream>
#include <limits>
int main()
{
constexpr int d = std::numeric_limits<int>::radix;
constexpr int c = std::numeric_limits<char>::radix;
constexpr int f = std::numeric_limits<double>::radix;
std::cout << "int : " << d << std::endl;
std::cout << "char : " << c << std::endl;
std::cout << "double : " << f << std::endl;
}
14
#include <iostream>
#include <limits>
int main()
{
constexpr int d = std::numeric_limits<int>::radix;
constexpr int c = std::numeric_limits<char>::radix;
constexpr int f = std::numeric_limits<double>::radix;
std::cout << "int : " << d << std::endl;
std::cout << "char : " << c << std::endl;
std::cout << "double : " << f << std::endl;
}
出力例
int : 2
char : 2
double : 2