- Made list of units static.
This commit is contained in:
Paul Beckingham 2015-03-06 21:15:50 -05:00
parent 4118fe70ae
commit c9d61ff71b

View file

@ -284,10 +284,11 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
std::string::size_type original_start = start; std::string::size_type original_start = start;
Nibbler n (input.substr (start)); Nibbler n (input.substr (start));
// TODO This can be made static, and so preserved between calls. // Static and so preserved between calls.
std::vector <std::string> units; static std::vector <std::string> units;
for (int i = 0; i < NUM_DURATIONS; i++) if (units.size () == 0)
units.push_back (durations[i].unit); for (int i = 0; i < NUM_DURATIONS; i++)
units.push_back (durations[i].unit);
std::string number; std::string number;
std::string unit; std::string unit;