]> git.tdb.fi Git - libs/datafile.git/commitdiff
Fix incorrect type in a range-for loop
authorMikko Rasa <tdb@tdb.fi>
Wed, 27 Dec 2023 11:18:22 +0000 (13:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 27 Dec 2023 22:10:07 +0000 (00:10 +0200)
source/collection.h

index 254c7b675c88c5bfc39bc11da277be725d0b9e6d..bc2a591e3be356bb74a01a36c41d6127a5714f59 100644 (file)
@@ -507,8 +507,8 @@ typename CollectionItemTypeChooser<T>::Type &Collection::add_type()
 template<typename T>
 typename CollectionItemTypeChooser<T>::Type &Collection::modify_type()
 {
-       for(CollectionItemTypeBase *t: types)
-               if(CollectionItemType<T> *tt = dynamic_cast<CollectionItemType<T> *>(t))
+       for(const auto &t: types)
+               if(CollectionItemType<T> *tt = dynamic_cast<CollectionItemType<T> *>(t.get()))
                        return *tt;
 
        throw std::logic_error("type not found in collection");