mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 04:54:19 -04:00
Avoid unnecessary detaching of containers
If only a constant iterator is needed, make the container const if possible, otherwise use cbegin() and cend() to get a constant iterator without detaching the container. These fixes are needed so that `auto` can deduce the correct iterator type.
This commit is contained in:
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
TagLib::String value = argv[i + 1];
|
||||
|
||||
TagLib::List<TagLib::FileRef>::ConstIterator it;
|
||||
for(it = fileList.begin(); it != fileList.end(); ++it) {
|
||||
for(it = fileList.cbegin(); it != fileList.cend(); ++it) {
|
||||
|
||||
TagLib::Tag *t = (*it).tag();
|
||||
|
||||
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
TagLib::List<TagLib::FileRef>::ConstIterator it;
|
||||
for(it = fileList.begin(); it != fileList.end(); ++it)
|
||||
for(it = fileList.cbegin(); it != fileList.cend(); ++it)
|
||||
(*it).file()->save();
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user