From 90fca083052880479ad90d870e556f0648e32106 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Jan 2018 00:41:34 +0100 Subject: Replace insert(make_pair(...)) with emplace --- ingen/Properties.hpp | 4 ++-- src/AtomReader.cpp | 4 ++-- src/ClashAvoider.cpp | 9 ++++---- src/Configuration.cpp | 6 +++--- src/Parser.cpp | 9 ++++---- src/Resource.cpp | 6 +++--- src/Serialiser.cpp | 2 +- src/Store.cpp | 4 ++-- src/World.cpp | 4 ++-- src/client/ClientStore.cpp | 2 +- src/client/GraphModel.cpp | 3 +-- src/client/PluginModel.cpp | 2 +- src/gui/GraphBox.cpp | 4 ++-- src/gui/GraphCanvas.cpp | 43 ++++++++++++++++----------------------- src/gui/LoadGraphWindow.cpp | 6 +++--- src/gui/LoadPluginWindow.cpp | 11 ++++------ src/gui/NewSubgraphWindow.cpp | 9 ++++---- src/gui/ObjectMenu.cpp | 5 ++--- src/gui/PluginMenu.cpp | 4 ++-- src/gui/PropertiesWindow.cpp | 13 ++++++------ src/gui/RDFS.cpp | 4 +--- src/gui/URIEntry.cpp | 4 ++-- src/gui/ingen_gui_lv2.cpp | 4 ++-- src/server/BlockFactory.cpp | 14 ++++++------- src/server/ClientUpdate.cpp | 2 +- src/server/DuplexPort.cpp | 8 ++++---- src/server/LV2Plugin.cpp | 5 ++--- src/server/events/CreateBlock.cpp | 6 +++--- src/server/events/Mark.cpp | 2 +- 29 files changed, 89 insertions(+), 110 deletions(-) diff --git a/ingen/Properties.hpp b/ingen/Properties.hpp index 39d6cf81..a80a00d9 100644 --- a/ingen/Properties.hpp +++ b/ingen/Properties.hpp @@ -67,13 +67,13 @@ public: void put(const Raul::URI& key, const Atom& value, Graph ctx = Graph::DEFAULT) { - insert(std::make_pair(key, Property(value, ctx))); + emplace(key, Property(value, ctx)); } void put(const Raul::URI& key, const URIs::Quark& value, Graph ctx = Graph::DEFAULT) { - insert(std::make_pair(key, Property(value, ctx))); + emplace(key, Property(value, ctx)); } bool contains(const Raul::URI& key, const Atom& value) { diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index f3263f65..5aa39657 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -59,12 +59,12 @@ AtomReader::get_props(const LV2_Atom_Object* obj, { if (obj->body.otype) { const Atom type(sizeof(int32_t), _uris.atom_URID, &obj->body.otype); - props.insert(std::make_pair(_uris.rdf_type, type)); + props.emplace(_uris.rdf_type, type); } LV2_ATOM_OBJECT_FOREACH(obj, p) { Atom val; get_atom(&p->value, val); - props.insert(std::make_pair(Raul::URI(_map.unmap_uri(p->key)), val)); + props.emplace(Raul::URI(_map.unmap_uri(p->key)), val); } } diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index 3ec3a12d..dafd4472 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -72,7 +72,7 @@ ClashAvoider::map_path(const Raul::Path& in) if (p != _symbol_map.end()) { const Raul::Path mapped = Raul::Path( p->second.base() + in.substr(parent.base().length())); - InsertRecord i = _symbol_map.insert(make_pair(in, mapped)); + InsertRecord i = _symbol_map.emplace(in, mapped); return i.first->second; } parent = parent.parent(); @@ -80,7 +80,7 @@ ClashAvoider::map_path(const Raul::Path& in) if (!exists(in) && _symbol_map.find(in) == _symbol_map.end()) { // No clash, use symbol unmodified - InsertRecord i = _symbol_map.insert(make_pair(in, in)); + InsertRecord i = _symbol_map.emplace(in, in); assert(i.second); return i.first->second; @@ -111,10 +111,9 @@ ClashAvoider::map_path(const Raul::Path& in) } Raul::Symbol sym(name); std::string str = ss.str(); - InsertRecord i = _symbol_map.insert( - make_pair(in, Raul::Path(str))); + InsertRecord i = _symbol_map.emplace(in, Raul::Path(str)); offset = _store.child_name_offset(in.parent(), sym, false); - _offsets.insert(make_pair(base_path, offset)); + _offsets.emplace(base_path, offset); return i.first->second; } else { if (o != _offsets.end()) { diff --git a/src/Configuration.cpp b/src/Configuration.cpp index a65967b5..6cda3289 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -89,12 +89,12 @@ Configuration::add(const std::string& key, { assert(value.type() == type || value.type() == 0); _max_name_length = std::max(_max_name_length, name.length()); - _options.insert(make_pair(name, Option{key, name, letter, desc, scope, type, value})); + _options.emplace(name, Option{key, name, letter, desc, scope, type, value}); if (!key.empty()) { - _keys.insert(make_pair(key, name)); + _keys.emplace(key, name); } if (letter != '\0') { - _short_names.insert(make_pair(letter, name)); + _short_names.emplace(letter, name); } return *this; } diff --git a/src/Parser.cpp b/src/Parser.cpp index d3b139af..d761c84e 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -147,8 +147,8 @@ get_properties(Ingen::World* world, Atom atomm; atomm = world->forge().alloc( atom->size, atom->type, LV2_ATOM_BODY_CONST(atom)); - props.insert(make_pair(Raul::URI(i.get_predicate().to_string()), - Property(atomm, ctx))); + props.emplace(Raul::URI(i.get_predicate().to_string()), + Property(atomm, ctx)); } } @@ -331,8 +331,7 @@ parse_block(Ingen::World* world, // Prototype is non-file URI, plugin Properties props = get_properties( world, model, subject, Resource::Graph::DEFAULT); - props.insert(make_pair(uris.rdf_type, - uris.forge.make_urid(uris.ingen_Block))); + props.emplace(uris.rdf_type, uris.forge.make_urid(uris.ingen_Block)); target->put(path_to_uri(path), props); } return path; @@ -592,7 +591,7 @@ parse(Ingen::World* world, if (s == subjects.end()) { std::set types; types.insert(rdf_class); - subjects.insert(make_pair(subject, types)); + subjects.emplace(subject, types); } else { s->second.insert(rdf_class); } diff --git a/src/Resource.cpp b/src/Resource.cpp index 5d980f8e..05c4fb4e 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -40,7 +40,7 @@ Resource::add_property(const Raul::URI& uri, if (uri != _uris.ingen_activity) { // Insert new property - const Atom& v = _properties.insert(make_pair(uri, Property(value, ctx)))->second; + const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; on_property(uri, v); } else { // Announce ephemeral activity, but do not store @@ -70,7 +70,7 @@ Resource::set_property(const Raul::URI& uri, if (uri != _uris.ingen_activity) { // Insert new property - const Atom& v = _properties.insert(make_pair(uri, Property(value, ctx)))->second; + const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; on_property(uri, v); return v; } else { @@ -228,7 +228,7 @@ Resource::properties(Resource::Graph ctx) const Properties props; for (const auto& p : _properties) { if (p.second.context() == ctx) { - props.insert(make_pair(p.first, p.second)); + props.emplace(p.first, p.second); } } diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index 2e125953..13a0f96d 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -499,7 +499,7 @@ Serialiser::Impl::serialise_port(const Node* port, const Atom& val = port->get_property(uris.ingen_value); if (val.is_valid()) { props.erase(uris.lv2_default); - props.insert(make_pair(uris.lv2_default, val)); + props.emplace(uris.lv2_default, val); } else { _world.log().warn("Control input has no value, lv2:default omitted.\n"); } diff --git a/src/Store.cpp b/src/Store.cpp index 13e38d37..327ce416 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -28,7 +28,7 @@ Store::add(Node* o) return; } - insert(make_pair(o->path(), SPtr(o))); + emplace(o->path(), SPtr(o)); for (uint32_t i = 0; i < o->num_ports(); ++i) { add(o->port(i)); @@ -110,7 +110,7 @@ Store::rename(const iterator top, const Raul::Path& new_path) i->second->set_path(path); assert(find(path) == end()); // Shouldn't be dropping objects! - insert(make_pair(path, i->second)); + emplace(path, i->second); } } diff --git a/src/World.cpp b/src/World.cpp index 84202244..8797bb3e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -286,7 +286,7 @@ World::load_module(const char* name) if (module) { module->library = lib; module->load(this); - _impl->modules.insert(make_pair(string(name), module)); + _impl->modules.emplace(string(name), module); return true; } } @@ -340,7 +340,7 @@ World::run(const std::string& mime_type, const std::string& filename) void World::add_interface_factory(const std::string& scheme, InterfaceFactory factory) { - _impl->interface_factories.insert(make_pair(scheme, factory)); + _impl->interface_factories.emplace(scheme, factory); } void diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 356a6b31..706b2c5b 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -189,7 +189,7 @@ ClientStore::add_plugin(SPtr pm) if (existing) { existing->set(pm); } else { - _plugins->insert(make_pair(pm->uri(), pm)); + _plugins->emplace(pm->uri(), pm); _signal_new_plugin.emit(pm); } } diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index b5838d19..0723e59b 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -134,8 +134,7 @@ GraphModel::add_arc(SPtr arc) assert(arc->tail() == existing->tail()); assert(arc->head() == existing->head()); } else { - _arcs.emplace(std::make_pair(arc->tail().get(), - arc->head().get()), + _arcs.emplace(std::make_pair(arc->tail().get(), arc->head().get()), arc); _signal_new_arc.emit(arc); } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index e8bdf12a..2ab4ccae 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -172,7 +172,7 @@ PluginModel::set(SPtr p) void PluginModel::add_preset(const Raul::URI& uri, const std::string& label) { - _presets.insert(std::make_pair(uri, label)); + _presets.emplace(uri, label); _signal_preset.emit(uri, label); } diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 5504b964..def101a7 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -889,8 +889,8 @@ GraphBox::event_sprung_layout_toggled() _view->canvas()->set_sprung_layout(sprung); Properties properties; - properties.insert(make_pair(_app->uris().ingen_sprungLayout, - _app->forge().make(sprung))); + properties.emplace(_app->uris().ingen_sprungLayout, + _app->forge().make(sprung)); _app->interface()->put(_graph->uri(), properties); } diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 3078e347..4c7c34c8 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -338,7 +338,7 @@ GraphCanvas::add_block(SPtr bm) } module->show(); - _views.insert(std::make_pair(bm, module)); + _views.emplace(bm, module); if (_pastees.find(bm->path()) != _pastees.end()) { module->set_selected(true); } @@ -363,7 +363,7 @@ void GraphCanvas::add_port(SPtr pm) { GraphPortModule* view = GraphPortModule::create(*this, pm); - _views.insert(std::make_pair(pm, view)); + _views.emplace(pm, view); view->show(); } @@ -803,19 +803,16 @@ GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, const URIs& uris = _app.uris(); Properties props = get_initial_data(Resource::Graph::INTERNAL); - props.insert(make_pair(uris.rdf_type, _app.forge().make_urid(type))); + props.emplace(uris.rdf_type, _app.forge().make_urid(type)); if (type == uris.atom_AtomPort) { - props.insert(make_pair(uris.atom_bufferType, - Property(uris.atom_Sequence))); - } - props.insert(make_pair(uris.rdf_type, - Property(is_output - ? uris.lv2_OutputPort - : uris.lv2_InputPort))); - props.insert(make_pair(uris.lv2_index, - _app.forge().make(int32_t(_graph->num_ports())))); - props.insert(make_pair(uris.lv2_name, - _app.forge().alloc(name.c_str()))); + props.emplace(uris.atom_bufferType, Property(uris.atom_Sequence)); + } + props.emplace( + uris.rdf_type, + Property(is_output ? uris.lv2_OutputPort : uris.lv2_InputPort)); + props.emplace(uris.lv2_index, + _app.forge().make(int32_t(_graph->num_ports()))); + props.emplace(uris.lv2_name, _app.forge().alloc(name.c_str())); _app.interface()->put(path_to_uri(path), props); } @@ -840,10 +837,8 @@ GraphCanvas::load_plugin(WPtr weak_plugin) // FIXME: polyphony? Properties props = get_initial_data(); - props.insert(make_pair(uris.rdf_type, - Property(uris.ingen_Block))); - props.insert(make_pair(uris.lv2_prototype, - uris.forge.make_urid(plugin->uri()))); + props.emplace(uris.rdf_type, Property(uris.ingen_Block)); + props.emplace(uris.lv2_prototype, uris.forge.make_urid(plugin->uri())); _app.interface()->put(path_to_uri(path), props); } @@ -864,14 +859,10 @@ GraphCanvas::get_initial_data(Resource::Graph ctx) { Properties result; const URIs& uris = _app.uris(); - result.insert( - make_pair(uris.ingen_canvasX, - Property(_app.forge().make((float)_menu_x), - ctx))); - result.insert( - make_pair(uris.ingen_canvasY, - Property(_app.forge().make((float)_menu_y), - ctx))); + result.emplace(uris.ingen_canvasX, + Property(_app.forge().make((float)_menu_x), ctx)); + result.emplace(uris.ingen_canvasY, + Property(_app.forge().make((float)_menu_y), ctx)); return result; } diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 28eb633a..10ddf436 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -156,9 +156,9 @@ LoadGraphWindow::ok_clicked() const URIs& uris = _app->uris(); if (_poly_voices_radio->get_active()) { - _initial_data.insert( - make_pair(uris.ingen_polyphony, - _app->forge().make(_poly_spinbutton->get_value_as_int()))); + _initial_data.emplace( + uris.ingen_polyphony, + _app->forge().make(_poly_spinbutton->get_value_as_int())); } if (get_uri() == "") { diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 65f09226..0eb65f8d 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -309,7 +309,7 @@ LoadPluginWindow::add_plugin(SPtr plugin) Gtk::TreeModel::iterator iter = _plugins_liststore->append(); Gtk::TreeModel::Row row = *iter; - _rows.insert(make_pair(plugin->uri(), iter)); + _rows.emplace(plugin->uri(), iter); set_row(row, plugin); @@ -398,12 +398,9 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) } else { Raul::Path path = _graph->path().child(Raul::Symbol::symbolify(name)); Properties props = _initial_data; - props.insert(make_pair(uris.rdf_type, - Property(uris.ingen_Block))); - props.insert(make_pair(uris.lv2_prototype, - _app->forge().make_urid(plugin->uri()))); - props.insert(make_pair(uris.ingen_polyphonic, - _app->forge().make(polyphonic))); + props.emplace(uris.rdf_type, Property(uris.ingen_Block)); + props.emplace(uris.lv2_prototype, _app->forge().make_urid(plugin->uri())); + props.emplace(uris.ingen_polyphonic, _app->forge().make(polyphonic)); _app->interface()->put(path_to_uri(path), props); if (_selection->get_selected_rows().size() == 1) { diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 03455adc..f9dc8fc4 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -94,16 +94,15 @@ NewSubgraphWindow::ok_clicked() // Create graph Properties props; - props.insert(make_pair(_app->uris().rdf_type, Property(_app->uris().ingen_Graph))); - props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); - props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); + props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph)); + props.emplace(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly))); + props.emplace(_app->uris().ingen_enabled, _app->forge().make(bool(true))); _app->interface()->put( path_to_uri(path), props, Resource::Graph::INTERNAL); // Set external (block perspective) properties props = _initial_data; - props.insert(make_pair(_app->uris().rdf_type, - Property(_app->uris().ingen_Graph))); + props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph)); _app->interface()->put( path_to_uri(path), _initial_data, Resource::Graph::EXTERNAL); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index c8ef9460..c113cac9 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -102,9 +102,8 @@ void ObjectMenu::on_menu_unlearn() { Properties remove; - remove.insert(std::make_pair( - _app->uris().midi_binding, - Property(_app->uris().patch_wildcard))); + remove.emplace(_app->uris().midi_binding, + Property(_app->uris().patch_wildcard)); _app->interface()->delta(_object->uri(), remove, Properties()); } diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp index e512d587..fc385773 100644 --- a/src/gui/PluginMenu.cpp +++ b/src/gui/PluginMenu.cpp @@ -48,7 +48,7 @@ PluginMenu::clear() if (!p) { p = lilv_plugin_class_get_uri(lv2_plugin); } - children.insert(std::make_pair(lilv_node_as_string(p), c)); + children.emplace(lilv_node_as_string(p), c); } std::set ancestors; @@ -128,7 +128,7 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu, size_t num_child_items = build_plugin_class_menu( submenu, c, classes, children, ancestors); - _class_menus.insert(std::make_pair(sub_uri_str, MenuRecord(menu_item, submenu))); + _class_menus.emplace(sub_uri_str, MenuRecord(menu_item, submenu)); if (num_child_items == 0) { menu_item->hide(); } diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 31e0aff4..db939b73 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -136,7 +136,7 @@ PropertiesWindow::add_property(const Raul::URI& key, const Atom& value) Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); _table->attach(*present, 2, 3, n_rows, n_rows + 1, Gtk::FILL, Gtk::SHRINK); - _records.insert(make_pair(key, Record(value, align, n_rows, present))); + _records.emplace(key, Record(value, align, n_rows, present)); _table->show_all(); lilv_node_free(prop); @@ -230,12 +230,12 @@ PropertiesWindow::set_object(SPtr model) RDFS::datatypes(_app->world(), ranges, false); Raul::URI widget_type("urn:nothing"); if (datatype_supported(ranges, &widget_type)) { - entries.insert(std::make_pair(label, p)); + entries.emplace(label, p); } } else { // Range is presumably a class, show if any instances are known if (class_supported(ranges)) { - entries.insert(std::make_pair(label, p)); + entries.emplace(label, p); } } } @@ -542,8 +542,7 @@ PropertiesWindow::add_clicked() if (value.is_valid()) { // Send property to engine Properties properties; - properties.insert(make_pair(Raul::URI(key_uri.c_str()), - Property(value))); + properties.emplace(Raul::URI(key_uri.c_str()), Property(value)); _app->interface()->put(_model->uri(), properties); } } @@ -565,10 +564,10 @@ PropertiesWindow::apply_clicked() const Record& record = r.second; if (record.present_button->get_active()) { if (!_model->has_property(uri, record.value)) { - add.insert(make_pair(uri, record.value)); + add.emplace(uri, record.value); } } else { - remove.insert(make_pair(uri, record.value)); + remove.emplace(uri, record.value); } } diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index 1a5e190a..b524aed7 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -210,9 +210,7 @@ instances(World* world, const URISet& types) continue; } const std::string label = RDFS::label(world, object); - result.insert( - std::make_pair(label, - Raul::URI(lilv_node_as_string(object)))); + result.emplace(label, Raul::URI(lilv_node_as_string(object))); } lilv_node_free(type); } diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp index 30e6edb2..3c236572 100644 --- a/src/gui/URIEntry.cpp +++ b/src/gui/URIEntry.cpp @@ -120,11 +120,11 @@ URIEntry::build_subclass_menu(const LilvNode* klass) std::map entries; LILV_FOREACH(nodes, s, subclasses) { const LilvNode* node = lilv_nodes_get(subclasses, s); - entries.insert(std::make_pair(RDFS::label(world, node), node)); + entries.emplace(RDFS::label(world, node), node); } LILV_FOREACH(nodes, s, subtypes) { const LilvNode* node = lilv_nodes_get(subtypes, s); - entries.insert(std::make_pair(RDFS::label(world, node), node)); + entries.emplace(RDFS::label(world, node), node); } // Add an item (possibly with a submenu) for each subclass/type diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 01ddc23e..57881741 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -145,8 +145,8 @@ instantiate(const LV2UI_Descriptor* descriptor, // Create empty root graph model Ingen::Properties props; - props.insert(std::make_pair(ui->app->uris().rdf_type, - Ingen::Property(ui->app->uris().ingen_Graph))); + props.emplace(ui->app->uris().rdf_type, + Ingen::Property(ui->app->uris().ingen_Graph)); ui->app->store()->put(Ingen::main_uri(), props); // Create a GraphBox for the root and set as the UI widget diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index d33be9fc..a1367e12 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -111,19 +111,19 @@ BlockFactory::load_internal_plugins() { Ingen::URIs& uris = _world->uris(); InternalPlugin* block_delay_plug = BlockDelayNode::internal_plugin(uris); - _plugins.insert(make_pair(block_delay_plug->uri(), block_delay_plug)); + _plugins.emplace(block_delay_plug->uri(), block_delay_plug); InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); - _plugins.insert(make_pair(controller_plug->uri(), controller_plug)); + _plugins.emplace(controller_plug->uri(), controller_plug); InternalPlugin* note_plug = NoteNode::internal_plugin(uris); - _plugins.insert(make_pair(note_plug->uri(), note_plug)); + _plugins.emplace(note_plug->uri(), note_plug); InternalPlugin* time_plug = TimeNode::internal_plugin(uris); - _plugins.insert(make_pair(time_plug->uri(), time_plug)); + _plugins.emplace(time_plug->uri(), time_plug); InternalPlugin* trigger_plug = TriggerNode::internal_plugin(uris); - _plugins.insert(make_pair(trigger_plug->uri(), trigger_plug)); + _plugins.emplace(trigger_plug->uri(), trigger_plug); } void @@ -138,7 +138,7 @@ BlockFactory::load_plugin(const Raul::URI& uri) const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node); if (plug) { LV2Plugin* const ingen_plugin = new LV2Plugin(_world, plug); - _plugins.insert(make_pair(uri, ingen_plugin)); + _plugins.emplace(uri, ingen_plugin); } lilv_node_free(node); } @@ -216,7 +216,7 @@ BlockFactory::load_lv2_plugins() auto p = _plugins.find(uri); if (p == _plugins.end()) { LV2Plugin* const plugin = new LV2Plugin(_world, lv2_plug); - _plugins.insert(make_pair(uri, plugin)); + _plugins.emplace(uri, plugin); } else if (lilv_plugin_verify(lv2_plug)) { p->second->set_is_zombie(false); } diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index a5f85cef..b65fac12 100644 --- a/src/server/ClientUpdate.cpp +++ b/src/server/ClientUpdate.cpp @@ -42,7 +42,7 @@ ClientUpdate::put_port(const PortImpl* port) if (port->is_a(PortType::CONTROL) || port->is_a(PortType::CV)) { Properties props = port->properties(); props.erase(uris.ingen_value); - props.insert(std::make_pair(uris.ingen_value, port->value())); + props.emplace(uris.ingen_value, port->value()); put(port->uri(), props); } else { put(port->uri(), port->properties()); diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index e81114ff..7e32e236 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -102,13 +102,13 @@ DuplexPort::inherit_neighbour(const PortImpl* port, if (_type == PortType::CONTROL || _type == PortType::CV) { if (port->minimum().get() < _min.get()) { _min = port->minimum(); - remove.insert(std::make_pair(uris.lv2_minimum, uris.patch_wildcard)); - add.insert(std::make_pair(uris.lv2_minimum, port->minimum())); + remove.emplace(uris.lv2_minimum, uris.patch_wildcard); + add.emplace(uris.lv2_minimum, port->minimum()); } if (port->maximum().get() > _max.get()) { _max = port->maximum(); - remove.insert(std::make_pair(uris.lv2_maximum, uris.patch_wildcard)); - add.insert(std::make_pair(uris.lv2_maximum, port->maximum())); + remove.emplace(uris.lv2_maximum, uris.patch_wildcard); + add.emplace(uris.lv2_maximum, port->maximum()); } } else if (_type == PortType::ATOM) { for (auto i = port->properties().find(uris.atom_supports); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 86bad136..d51aeda3 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -122,9 +122,8 @@ LV2Plugin::load_presets() if (labels) { const LilvNode* label = lilv_nodes_get_first(labels); - _presets.insert( - std::make_pair(Raul::URI(lilv_node_as_uri(preset)), - lilv_node_as_string(label))); + _presets.emplace(Raul::URI(lilv_node_as_uri(preset)), + lilv_node_as_string(label)); lilv_nodes_free(labels); } else { diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index eb307711..2c7978b1 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -71,7 +71,7 @@ CreateBlock::pre_process(PreProcessContext& ctx) const auto value = i->second; auto next = i; next = _properties.erase(i); - _properties.insert(std::make_pair(uris.lv2_prototype, value)); + _properties.emplace(uris.lv2_prototype, value); i = next; } @@ -106,8 +106,8 @@ CreateBlock::pre_process(PreProcessContext& ctx) but the client expects an actual LV2 plugin as prototype. */ _properties.erase(uris.ingen_prototype); _properties.erase(uris.lv2_prototype); - _properties.insert(std::make_pair(uris.lv2_prototype, - uris.forge.make_urid(ancestor->plugin()->uri()))); + _properties.emplace(uris.lv2_prototype, + uris.forge.make_urid(ancestor->plugin()->uri())); } else { // Prototype is a plugin PluginImpl* const plugin = _engine.block_factory()->plugin(prototype); diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index 90b449d5..3c0dfaaf 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -60,7 +60,7 @@ Mark::pre_process(PreProcessContext& ctx) for (GraphImpl* g : ctx.dirty_graphs()) { MPtr cg = compile(*_engine.maid(), *g); if (cg) { - _compiled_graphs.insert(std::make_pair(g, std::move(cg))); + _compiled_graphs.emplace(g, std::move(cg)); } } ctx.dirty_graphs().clear(); -- cgit v1.2.1