Use make_intrusive/make_shared for smart pointer construction.

This commit is contained in:
Twan van Laarhoven
2020-04-23 23:51:34 +02:00
parent 815df01ba5
commit 708b4389a0
67 changed files with 313 additions and 329 deletions
+2 -2
View File
@@ -21,11 +21,11 @@ template <typename Key, typename Value>
IndexMap<Key,Value>& DelayedIndexMaps<Key,Value>::get(const String& name, const vector<Key>& init_with) {
intrusive_ptr<DelayedIndexMapsData<Key,Value> >& item = data[name];
if (!item) { // no item, make a new one
item = intrusive(new DelayedIndexMapsData<Key,Value>);
item = make_intrusive<DelayedIndexMapsData<Key,Value>>();
item->read_data.init(init_with);
} else if (!item->unread_data.empty()) { // not read, read now
item->read_data.init(init_with);
Reader reader(shared(new wxStringInputStream(item->unread_data)), nullptr, _("delayed data for ") + name);
Reader reader(make_shared<wxStringInputStream>(item->unread_data), nullptr, _("delayed data for ") + name);
reader.handle_greedy(item->read_data);
item->unread_data.clear();
}