1010#include < LightGBM/utils/random.h>
1111
1212#include < algorithm>
13+ #include < cctype>
1314#include < limits>
1415#include < string>
1516#include < unordered_map>
@@ -104,7 +105,7 @@ std::unordered_map<std::string, std::string> Config::Str2Map(const char* paramet
104105void GetBoostingType (const std::unordered_map<std::string, std::string>& params, std::string* boosting) {
105106 std::string value;
106107 if (Config::GetString (params, " boosting" , &value)) {
107- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
108+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
108109 if (value == std::string (" gbdt" ) || value == std::string (" gbrt" )) {
109110 *boosting = " gbdt" ;
110111 } else if (value == std::string (" dart" )) {
@@ -122,7 +123,7 @@ void GetBoostingType(const std::unordered_map<std::string, std::string>& params,
122123void GetDataSampleStrategy (const std::unordered_map<std::string, std::string>& params, std::string* strategy) {
123124 std::string value;
124125 if (Config::GetString (params, " data_sample_strategy" , &value)) {
125- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
126+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
126127 if (value == std::string (" goss" )) {
127128 *strategy = " goss" ;
128129 } else if (value == std::string (" bagging" )) {
@@ -149,15 +150,15 @@ void ParseMetrics(const std::string& value, std::vector<std::string>* out_metric
149150void GetObjectiveType (const std::unordered_map<std::string, std::string>& params, std::string* objective) {
150151 std::string value;
151152 if (Config::GetString (params, " objective" , &value)) {
152- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
153+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
153154 *objective = ParseObjectiveAlias (value);
154155 }
155156}
156157
157158void GetMetricType (const std::unordered_map<std::string, std::string>& params, const std::string& objective, std::vector<std::string>* metric) {
158159 std::string value;
159160 if (Config::GetString (params, " metric" , &value)) {
160- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
161+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
161162 ParseMetrics (value, metric);
162163 }
163164 // add names of objective function if not providing metric
@@ -169,7 +170,7 @@ void GetMetricType(const std::unordered_map<std::string, std::string>& params, c
169170void GetTaskType (const std::unordered_map<std::string, std::string>& params, TaskType* task) {
170171 std::string value;
171172 if (Config::GetString (params, " task" , &value)) {
172- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
173+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
173174 if (value == std::string (" train" ) || value == std::string (" training" )) {
174175 *task = TaskType::kTrain ;
175176 } else if (value == std::string (" predict" ) || value == std::string (" prediction" )
@@ -190,7 +191,7 @@ void GetTaskType(const std::unordered_map<std::string, std::string>& params, Tas
190191void GetDeviceType (const std::unordered_map<std::string, std::string>& params, std::string* device_type) {
191192 std::string value;
192193 if (Config::GetString (params, " device_type" , &value)) {
193- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
194+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
194195 if (value == std::string (" cpu" )) {
195196 *device_type = " cpu" ;
196197 } else if (value == std::string (" gpu" )) {
@@ -206,7 +207,7 @@ void GetDeviceType(const std::unordered_map<std::string, std::string>& params, s
206207void GetTreeLearnerType (const std::unordered_map<std::string, std::string>& params, std::string* tree_learner) {
207208 std::string value;
208209 if (Config::GetString (params, " tree_learner" , &value)) {
209- std::transform (value.begin (), value.end (), value.begin (), Common ::tolower);
210+ std::transform (value.begin (), value.end (), value.begin (), []( unsigned char c){ return std ::tolower(c); } );
210211 if (value == std::string (" serial" )) {
211212 *tree_learner = " serial" ;
212213 } else if (value == std::string (" feature" ) || value == std::string (" feature_parallel" )) {
0 commit comments