|
static const std::type_info & | guessType (const std::string &value) |
| Given a string, check if it could be stored as int or double instead of std::string .
|
|
static const std::type_info & | guessType (double d, const std::type_info &type=typeid(unsigned char)) |
| Returns the (loosely) minimal type that could store the value without precision loss.
|
|
template<class C > |
static const std::type_info & | guessArrayType (const C &container) |
| Given a vector or list of strings, suggest a matching storage type (int, double, std::string).
|
|
template<typename T , typename S > |
static bool | isWithinRange (const S &x) |
|
template<typename S > |
static bool | isWithinRange (const S &x, const std::type_info &type) |
|
template<typename T = unsigned char> |
static const std::type_info & | minimizeIntType (double value) |
| Return a minimal numeric type, that can contain a numeric value.
|
|
static const std::type_info & | minimizeIntType (double value, const std::type_info &type=typeid(unsigned char)) |
| Return a minimal numeric type, that can contain a numeric value.
|
|
◆ guessArrayType()
template<class C >
const std::type_info & guessArrayType |
( |
const C & |
l | ) |
|
|
static |
Given a vector or list of strings, suggest a matching storage type (int, double, std::string).
- Template Parameters
-
C | - contrainer, esp. std::list or std::vector |
Starting from uchar, rising until
Contains at least one string
Contains at least one decimal value
Contains only true
and \false values
◆ guessType()
const std::type_info & guessType |
( |
const std::string & |
value | ) |
|
|
static |
Given a string, check if it could be stored as int
or double
instead of std::string
.
- Returns
- - std::type_info in priority order: int, double, std::string.
Testing string '-123.456e+789' yields
0 = -123.456e+789 1 = '-123' 2 = '.456' 3 = 'e+789'
◆ isWithinRange() [1/2]
template<typename T , typename S >
static bool isWithinRange |
( |
const S & |
x | ) |
|
|
inlinestatic |
- Template Parameters
-
T | - range-tested type |
S | - source type |
◆ isWithinRange() [2/2]
template<typename S >
static bool isWithinRange |
( |
const S & |
x, |
|
|
const std::type_info & |
type |
|
) |
| |
|
inlinestatic |
- Template Parameters
-
T | - range-tested type |
S | - source type |
◆ minimizeIntType() [1/2]
template<typename T = unsigned char>
static const std::type_info & minimizeIntType |
( |
double |
value | ) |
|
|
inlinestatic |
Return a minimal numeric type, that can contain a numeric value.
- Parameters
-
value | - numeric value to be tested |
- Template Parameters
-
T | - minimal type allowed, for example short int. |
◆ minimizeIntType() [2/2]
const std::type_info & minimizeIntType |
( |
double |
value, |
|
|
const std::type_info & |
type = typeid(unsigned char) |
|
) |
| |
|
static |
Return a minimal numeric type, that can contain a numeric value.
- Parameters
-
value | - numeric value to be tested |
type | - minimal type allowed |
The documentation for this struct was generated from the following files: