From 06a89370e57761cb101cd6e99d8dc04fe90473aa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 12 Dec 2023 11:45:25 +0200 Subject: [PATCH] Use the auto type in a few places that were missed previously --- source/binarywriter.cpp | 2 +- source/collection.cpp | 4 ++-- source/collection.h | 4 ++-- source/directorysource.cpp | 2 +- source/packsource.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/binarywriter.cpp b/source/binarywriter.cpp index 87111f0..7558125 100644 --- a/source/binarywriter.cpp +++ b/source/binarywriter.cpp @@ -117,7 +117,7 @@ void BinaryWriter::write_int(IntType::Store n) void BinaryWriter::write_string(const StringType::Store &s) { - StringMap::const_iterator i = strings.find(s); + auto i = strings.find(s); if(i!=strings.end()) write_int(-static_cast(i->second)); else diff --git a/source/collection.cpp b/source/collection.cpp index b9b17f4..6e857b5 100644 --- a/source/collection.cpp +++ b/source/collection.cpp @@ -33,7 +33,7 @@ const Variant &Collection::get_var(const string &name, const CollectionItemTypeB const Variant *Collection::find_var(const string &name, const CollectionItemTypeBase *type) { - ItemMap::iterator i = items.find(name); + auto i = items.find(name); if(i!=items.end()) return &i->second; @@ -77,7 +77,7 @@ void Collection::gather_items(vector *vars, list *names unsigned Collection::get_status(const string &name, const CollectionItemTypeBase &type) const { - ItemMap::const_iterator i = items.find(name); + auto i = items.find(name); if(i==items.end()) { auto j = find_if(sources, [&name, &type](const CollectionSource *s){ return s->is_loadable(type, name); }); diff --git a/source/collection.h b/source/collection.h index 45dd103..f2e156e 100644 --- a/source/collection.h +++ b/source/collection.h @@ -123,7 +123,7 @@ public: template T *find(const std::string &name) const { - ItemMap::const_iterator i = items.find(name); + auto i = items.find(name); return (i!=items.end() ? extract::type>(i->second) : 0); } @@ -216,7 +216,7 @@ private: if(CollectionItemTypeBase *type = get_type()) return get_status(name, *type); - ItemMap::const_iterator i = items.find(name); + auto i = items.find(name); return (i!=items.end() && i->second.has_type>()); } diff --git a/source/directorysource.cpp b/source/directorysource.cpp index a933977..d57397a 100644 --- a/source/directorysource.cpp +++ b/source/directorysource.cpp @@ -51,7 +51,7 @@ unique_ptr DirectorySource::open(const string &name) const bool DirectorySource::lookup_file(const string &name, FS::Path &result) const { - ObjectMap::const_iterator i = objects.find(name); + auto i = objects.find(name); if(i==objects.end()) return false; diff --git a/source/packsource.cpp b/source/packsource.cpp index 84cdebd..560c373 100644 --- a/source/packsource.cpp +++ b/source/packsource.cpp @@ -38,9 +38,9 @@ PackSource &PackSource::operator=(const PackSource &other) void PackSource::translate_maps(const PackSource &other) { - for(list::const_iterator i=packs.begin(), j=other.packs.begin(); (i!=packs.end() && j!=other.packs.end()); ++i, ++j) + for(auto i=packs.begin(), j=other.packs.begin(); (i!=packs.end() && j!=other.packs.end()); ++i, ++j) i->translate_files(files, *j); - for(FileMap::const_iterator i=files.begin(), j=other.files.begin(); (i!=files.end() && j!=other.files.end()); ++i, ++j) + for(auto i=files.begin(), j=other.files.begin(); (i!=files.end() && j!=other.files.end()); ++i, ++j) i->second->translate_objects(objects, *j->second); } -- 2.45.2