mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Fix a very nasty conversion bug in Option c'tor
Sometimes C++ can be really bad! In this case an hard coded c string selects Option c'tor with int argument instead of the std::string one becuase it is considered a better matching by the compiler. Fix the bug changing the argument type from std::string to const char* so to be a better match then the int one. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ namespace {
|
|||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
Option();
|
Option();
|
||||||
Option(const std::string& defaultValue, OptionType = STRING);
|
Option(const char* defaultValue, OptionType = STRING);
|
||||||
Option(bool defaultValue, OptionType = CHECK);
|
Option(bool defaultValue, OptionType = CHECK);
|
||||||
Option(int defaultValue, int minValue, int maxValue);
|
Option(int defaultValue, int minValue, int maxValue);
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ namespace {
|
|||||||
|
|
||||||
Option::Option() {} // To allow insertion in a std::map
|
Option::Option() {} // To allow insertion in a std::map
|
||||||
|
|
||||||
Option::Option(const std::string& def, OptionType t)
|
Option::Option(const char* def, OptionType t)
|
||||||
: defaultValue(def), currentValue(def), type(t), idx(options.size()), minValue(0), maxValue(0) {}
|
: defaultValue(def), currentValue(def), type(t), idx(options.size()), minValue(0), maxValue(0) {}
|
||||||
|
|
||||||
Option::Option(bool def, OptionType t)
|
Option::Option(bool def, OptionType t)
|
||||||
|
|||||||
Reference in New Issue
Block a user