Sqlite: Use emplace_back instead of push_back

It does not only removes code it should be even more optimal.

Change-Id: I819a7300ca798c3109b20c1e3bafcd19078faebd
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2021-03-01 16:39:53 +01:00
parent 5c459be526
commit a6f944e472

View File

@@ -349,7 +349,7 @@ public:
bindValues(queryValues...); bindValues(queryValues...);
while (BaseStatement::next()) while (BaseStatement::next())
pushBackToContainer<ResultTypeCount>(container); emplaceBackValues<ResultTypeCount>(container);
resetter.reset(); resetter.reset();
} }
@@ -448,19 +448,6 @@ private:
return callCallable(callable, std::make_integer_sequence<int, ResultTypeCount>{}); return callCallable(callable, std::make_integer_sequence<int, ResultTypeCount>{});
} }
template<typename Container, int... ColumnIndices>
void pushBackToContainer(Container &container, std::integer_sequence<int, ColumnIndices...>)
{
using Type = typename Container::value_type;
container.push_back(Type(ValueGetter(*this, ColumnIndices)...));
}
template<int ResultTypeCount, typename Container>
void pushBackToContainer(Container &container)
{
pushBackToContainer(container, std::make_integer_sequence<int, ResultTypeCount>{});
}
template<typename ValueType> template<typename ValueType>
void bindValuesByIndex(int index, const ValueType &value) void bindValuesByIndex(int index, const ValueType &value)
{ {