mirror of
https://github.com/taglib/taglib.git
synced 2026-07-13 06:41:36 -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:
@@ -333,8 +333,8 @@ public:
|
||||
unsigned int read(TagLib::File &file, unsigned int limit) override
|
||||
{
|
||||
unsigned int sumcount = 0;
|
||||
for(List<Reader*>::ConstIterator i = m_readers.begin();
|
||||
limit > 0 && i != m_readers.end(); ++ i) {
|
||||
for(List<Reader*>::ConstIterator i = m_readers.cbegin();
|
||||
limit > 0 && i != m_readers.cend(); ++ i) {
|
||||
unsigned int count = (*i)->read(file, limit);
|
||||
limit -= count;
|
||||
sumcount += count;
|
||||
|
||||
Reference in New Issue
Block a user