core: Fix the command-line default string
Symptom: When a command line parameter's default value string contains a white space, it is not printed in the help message Root Cause Analysis: While the construction of the stringstream of a particular data type can be arbitrarily designed, possibly including white spaces, the command-line class either inadvertentely failed to support a string including white spaces or intentionally decided not to support a white character in the default value string. The latter case is a design bug, if intended, because the command line class cannot enforce how a data type's string may be constructed. Fix: Take the whole string the stringstream constructs.
This commit is contained in:
@@ -742,7 +742,7 @@ CommandLine::AddValue(const std::string& name, const std::string& help, T& value
|
||||
|
||||
std::stringstream ss;
|
||||
ss << value;
|
||||
ss >> item->m_default;
|
||||
item->m_default = ss.str(); // Including white spaces
|
||||
|
||||
m_options.push_back(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user