49#ifndef DOXYGEN_SHOULD_SKIP_THIS
65 value = std::stof(str, &pos);
66 }
catch (std::invalid_argument&) {
67 GUM_ERROR(TypeError,
"the value is not a number")
68 }
catch (std::out_of_range&) {
GUM_ERROR(OutOfBounds,
"the value is too huge") }
71 for (
auto iter = str.begin() + pos, end = str.end(); iter != end; ++iter) {
72 if (!std::isspace(
static_cast< unsigned char >(*iter)))
73 GUM_ERROR(TypeError,
"the value is not a number")
76 if (belongs(value))
return value;
77 else GUM_ERROR(OutOfBounds,
"the value does not belong to the domain of the variable")
86 value = std::stod(str, &pos);
87 }
catch (std::invalid_argument&) {
88 GUM_ERROR(TypeError,
"the value is not a number")
89 }
catch (std::out_of_range&) {
GUM_ERROR(OutOfBounds,
"the value is too huge") }
92 for (
auto iter = str.begin() + pos, end = str.end(); iter != end; ++iter) {
93 if (!std::isspace(
static_cast< unsigned char >(*iter)))
94 GUM_ERROR(TypeError,
"the value is not a number")
97 if (belongs(value))
return value;
98 else GUM_ERROR(OutOfBounds,
"the value does not belong to the domain of the variable")
GUM_SCALAR operator[](const std::string &str) const
returns the T_VAL corresponding to a string
Header of ContinuousVariable.
#define GUM_ERROR(type, msg)
gum is the global namespace for all aGrUM entities