]> git.tdb.fi Git - builder.git/commitdiff
Use braced initializer lists for map insertions
authorMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 14:52:50 +0000 (16:52 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 17:19:09 +0000 (19:19 +0200)
source/builder.cpp
source/buildercli.cpp
source/buildgraph.cpp
source/cache.cpp
source/config.cpp
source/packagemanager.cpp
source/virtualfilesystem.cpp

index 21592661624742d5085d48a73a1c4ccf76e79572..a49624d13201d6eb8d9112f6653c1546909cf85f 100644 (file)
@@ -324,7 +324,7 @@ void Builder::Loader::build_type(const string &n)
 {
        BuildType btype(n);
        load_sub(btype);
-       auto i = obj.build_types.insert(BuildTypeMap::value_type(n, btype)).first;
+       auto i = obj.build_types.insert({ n, btype }).first;
        if(!obj.build_type)
                obj.build_type = &i->second;
 }
index bf53c2912dfd59c964a9e8d96f26e14796105eea..94b8f52e2bda19245801438ba0127251f3fe2e9a 100644 (file)
@@ -126,7 +126,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
                string::size_type equal = i->find('=');
                if(equal!=string::npos)
                {
-                       cmdline_options.insert(Config::InputOptions::value_type(i->substr(0, equal), i->substr(equal+1)));
+                       cmdline_options.insert({ i->substr(0, equal), i->substr(equal+1) });
                        cmdline_targets.erase(i++);
                }
                else
index 46c0c4855ae02544cac7e8fee47e471b969da914..070f934f6665edaa079885a1f8efa7b1f864e76b 100644 (file)
@@ -33,7 +33,7 @@ Target *BuildGraph::get_target(const string &n) const
 
 void BuildGraph::add_target(Target *t)
 {
-       targets.insert(TargetMap::value_type(t->get_name(), t));
+       targets.insert({ t->get_name(), t });
 }
 
 void BuildGraph::add_primary_target(Target &t)
index 61a4cb4e6d6f9657f22e5a2b458f6ddfdd989234..57b16d118ecd01cc27f99626e89cd9a5866ca475 100644 (file)
@@ -75,7 +75,7 @@ void Cache::append_value(const Target *tgt, const string &k, const string &v)
        Key key(tgt->get_name(), k);
        auto i = data.find(key);
        if(i==data.end())
-               i = data.insert(DataMap::value_type(key, ValueList())).first;
+               i = data.insert({ key, ValueList() }).first;
        i->second.push_back(v);
        changed = true;
        package.get_builder().get_logger().log("cache", format("Updated key %s %s+ %s", tgt->get_name(), k, v));
index a0603cfafc21fba7777a899de24a3c5bcffaa198..67f932fbafe9fa29fc06d0a0637027badb42e8a4 100644 (file)
@@ -23,7 +23,7 @@ const Config::Option &Config::add_option(const Feature &f)
        if(i!=pending_options.end())
                opt.value = i->second;
 
-       return options.insert(OptionMap::value_type(opt.name, opt)).first->second;
+       return options.insert({ opt.name, opt }).first->second;
 }
 
 bool Config::set_option(const string &opt, const string &val)
index 54cd550d062b9fc4014bf706e854e98e31d8b72f..af672d9710fd175db235bf9be11d2ba730ef20b8 100644 (file)
@@ -59,7 +59,7 @@ void PackageManager::add_package(Package *pkg)
        if(packages.empty())
                main_pkg = pkg;
 
-       packages.insert(PackageMap::value_type(pkg->get_name(), pkg));
+       packages.insert({ pkg->get_name(), pkg });
 }
 
 Package *PackageManager::get_package(const string &name) const
@@ -114,7 +114,7 @@ Package *PackageManager::find_package(const string &name)
                flags_str = run_pkgconfig(name, "staticflags");
                BinaryPackage::Flags static_flags = split(flags_str);
                Package *pkg = BinaryPackage::from_flags(builder, name, flags, static_flags);
-               packages.insert(PackageMap::value_type(name, pkg));
+               packages.insert({ name, pkg });
                return pkg;
        }
        catch(...)
index 0c3ee36ec830e09864ea6416b113109c15b5ff3f..7855e04ac99bc148bbbc2dbd4c685fafd01214e3 100644 (file)
@@ -30,7 +30,7 @@ FileTarget *VirtualFileSystem::get_target(const FS::Path &p) const
 
 void VirtualFileSystem::register_path(const FS::Path &path, FileTarget *t)
 {
-       targets.insert(TargetMap::value_type(path.str(), t));
+       targets.insert({ path, t });
        nonexistent.erase(path);
        builder.get_logger().log("vfs", format("Path %s registered to %s", path, t->get_name()));
 }