diff --git a/src/ray/common/ray_config.h b/src/ray/common/ray_config.h index 0a38f0597..2c93dbb95 100644 --- a/src/ray/common/ray_config.h +++ b/src/ray/common/ray_config.h @@ -14,7 +14,9 @@ #pragma once +#include #include +#include #include #include "ray/util/logging.h" @@ -50,8 +52,17 @@ class RayConfig { /// A helper macro that helps to set a value to a config item. #define RAY_CONFIG(type, name, default_value) \ if (pair.first == #name) { \ - std::istringstream stream(pair.second); \ - stream >> name##_; \ + if (typeid(type) == typeid(bool)) { \ + std::string value = pair.second; \ + std::transform(value.begin(), \ + value.end(), \ + value.begin(), \ + ::tolower); \ + name##_ = value == "true"; \ + } else { \ + std::istringstream stream(pair.second); \ + stream >> name##_; \ + } \ continue; \ }