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...merge-requests/15/head
parent
514f2ddbd9
commit
d2fba40cb4
|
@ -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 New Issue