ObserverHerb / Celeste

A Twitch bot written in C++/Qt with a focus on multimedia and native performance
GNU General Public License v3.0
6 stars 0 forks source link

Fix try_emplace usages #189

Closed ObserverHerb closed 1 month ago

ObserverHerb commented 2 months ago

Apparently I didn't really understand how emplace works when I switched to it. Take advantage of forwarding parameters rather than creating the object and passing it in.

./bot.cpp:203:                  commands.try_emplace(alias,alias,&commands.at(name));
./bot.cpp:328:  redemptions.try_emplace(name,Command{
./bot.cpp:701:          tags.try_emplace(*key,*value);
./panes.cpp:342:        lines.emplace_back(Line{text,1});
./pulsar.cpp:67:                                dimensions.try_emplace(jsonFieldScene->toString(),QSize{jsonFieldDimensionsX->toInt(),jsonFieldDimensionsY->toInt()});
./pulsar.cpp:87:                if (triggers.try_emplace(name,jsonFieldSources->toArray()).second)
./pulsar.cpp:90:                        if (jsonFieldCommand != jsonObjectTrigger.end()) commandCrossReference.try_emplace(name,jsonFieldCommand->toString());
./widgets.cpp:898:                                      entries.try_emplace(entry->Name(),entry);
./widgets.cpp:931:                      entries.try_emplace(entry->Name(),entry);
./widgets.cpp:985:                              commands.try_emplace(name,Command{
./widgets.cpp:1000:                                     commands.try_emplace(alias,Command{