31template <
typename T, T (*strtox)(const
char* str,
char** endptr)>
35 T result = strtox(s, &end);
36 if (errno != 0 || s == end || *end !=
'\0') {
39 if (result <
min || max < result) {
52 double min = std::numeric_limits<double>::lowest(),
53 double max = std::numeric_limits<double>::max()) {
54 return ParseFloatingPoint<double, strtod>(s, out,
min, max);
56static inline bool ParseDouble(
const std::string& s,
double* out,
57 double min = std::numeric_limits<double>::lowest(),
58 double max = std::numeric_limits<double>::max()) {
59 return ParseFloatingPoint<double, strtod>(s.c_str(), out,
min, max);
66 float min = std::numeric_limits<float>::lowest(),
67 float max = std::numeric_limits<float>::max()) {
68 return ParseFloatingPoint<float, strtof>(s, out,
min, max);
70static inline bool ParseFloat(
const std::string& s,
float* out,
71 float min = std::numeric_limits<float>::lowest(),
72 float max = std::numeric_limits<float>::max()) {
73 return ParseFloatingPoint<float, strtof>(s.c_str(), out,
min, max);
#define min(a, b)
Definition: ext4_utils.h:44
static bool ParseFloat(const char *s, float *out, float min=std::numeric_limits< float >::lowest(), float max=std::numeric_limits< float >::max())
Definition: parsedouble.h:65
static bool ParseDouble(const char *s, double *out, double min=std::numeric_limits< double >::lowest(), double max=std::numeric_limits< double >::max())
Definition: parsedouble.h:51
static bool ParseFloatingPoint(const char *s, T *out, T min, T max)
Definition: parsedouble.h:32