mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 00:57:19 +02:00
C++11: Cleaned up program framework with range-based for
This commit is contained in:
parent
5a57dfd70d
commit
e74c6963a9
28 changed files with 937 additions and 1221 deletions
13
src/util.cpp
13
src/util.cpp
|
@ -156,23 +156,22 @@ int autoComplete (
|
|||
unsigned int length = partial.length ();
|
||||
if (length)
|
||||
{
|
||||
std::vector <std::string>::const_iterator item;
|
||||
for (item = list.begin (); item != list.end (); ++item)
|
||||
for (auto& item : list)
|
||||
{
|
||||
// An exact match is a special case. Assume there is only one exact match
|
||||
// and return immediately.
|
||||
if (partial == *item)
|
||||
if (partial == item)
|
||||
{
|
||||
matches.clear ();
|
||||
matches.push_back (*item);
|
||||
matches.push_back (item);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Maintain a list of partial matches.
|
||||
else if (length >= (unsigned) minimum &&
|
||||
length <= item->length () &&
|
||||
partial == item->substr (0, length))
|
||||
matches.push_back (*item);
|
||||
length <= item.length () &&
|
||||
partial == item.substr (0, length))
|
||||
matches.push_back (item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue