From: Marco Costalba Date: Sat, 11 Apr 2009 10:46:47 +0000 (+0200) Subject: Use a map instead of a vector to store UCI options X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=f0701e2b0f4283ba558e7d8cab8e41cf11a19cdd;hp=95aadb5e53b6b605412682e0138235c6710138d1 Use a map instead of a vector to store UCI options Apart from the teoretical speed increase, the main reason of this patch is a good amount of code cleanup. Note that now UCI options are printed in alphabetical order and not in insertion order as before. Next patch will take care of restoring old behaviour. Signed-off-by: Marco Costalba --- diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 95e3e279..9e992be5 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -23,6 +23,7 @@ //// #include +#include #include #include #include @@ -55,91 +56,92 @@ namespace { struct Option { - std::string name, defaultValue, currentValue; + std::string defaultValue, currentValue; OptionType type; int minValue, maxValue; ComboValues comboValues; - Option(const char* name, const char* defaultValue, OptionType = STRING); - Option(const char* name, bool defaultValue, OptionType = CHECK); - Option(const char* name, int defaultValue, int minValue, int maxValue); + Option(); + Option(const std::string& defaultValue, OptionType = STRING); + Option(bool defaultValue, OptionType = CHECK); + Option(int defaultValue, int minValue, int maxValue); }; - typedef std::vector