mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Small improvements
Its always better to reserve memory when we can for a vector. Also, STL implements a lot of algorithms, its better to use them in case someday you need to change it to something alike. Like reversing the copy, use transform instead, etc...
This commit is contained in:
parent
514f2ddbd9
commit
d2fba40cb4
1 changed files with 2 additions and 2 deletions
|
@ -70,8 +70,8 @@ struct Steam_Inventory_Requests* new_inventory_result(bool full_query=true, cons
|
||||||
request.inventory_result = result;
|
request.inventory_result = result;
|
||||||
request.full_query = full_query;
|
request.full_query = full_query;
|
||||||
if (pInstanceIDs && unCountInstanceIDs) {
|
if (pInstanceIDs && unCountInstanceIDs) {
|
||||||
for (int i = 0; i < unCountInstanceIDs; ++i)
|
request.instance_ids.reserve(unCountInstanceIDs);
|
||||||
request.instance_ids.push_back(pInstanceIDs[i]);
|
std::copy(pInstanceIDs, pInstanceIDs + unCountInstanceIDs, std::back_inserter(request.instance_ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
request.time_created = std::chrono::system_clock::now();
|
request.time_created = std::chrono::system_clock::now();
|
||||||
|
|
Loading…
Reference in a new issue