diff options
author | Marco Bubke <marco.bubke@qt.io> | 2024-04-22 14:29:50 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2024-04-22 15:35:11 +0000 |
commit | b74c47ec66d99d9ade7621bdae2a76fd10be5f11 (patch) | |
tree | 04cfb1d24261915fdcc346222372884ef22a8d2a /src/libs | |
parent | e262ec1ebbb51402fdd8583e51f131ee5f04e3a6 (diff) |
QmlDesigner: Remove template parameter from project storage
There are now other ways to prevent locking bugs. So we don't need the
template parameter anymore. That makes it possible to move much of the
code to a cpp file. Maybe later we have to move some functions back for
performance reasons.
Change-Id: I01269912618d7cf5e070219e7edaa3a00623b7cf
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/sqlite/sqlitebasestatement.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libs/sqlite/sqlitebasestatement.h b/src/libs/sqlite/sqlitebasestatement.h index 81b31473f8..3710021ff5 100644 --- a/src/libs/sqlite/sqlitebasestatement.h +++ b/src/libs/sqlite/sqlitebasestatement.h @@ -210,6 +210,14 @@ public: struct is_container<QVarLengthArray<T, Prealloc>> : std::true_type {}; + template<typename T> + struct is_small_container : std::false_type + {}; + + template<typename T, qsizetype Prealloc> + struct is_small_container<QVarLengthArray<T, Prealloc>> : std::true_type + {}; + template<typename Container, std::size_t capacity = 32, typename = std::enable_if_t<is_container<Container>::value>, @@ -223,14 +231,16 @@ public: Resetter resetter{this}; Container resultValues; - resultValues.reserve(std::max(capacity, m_maximumResultCount)); + using size_tupe = typename Container::size_type; + if constexpr (!is_small_container<Container>::value) + resultValues.reserve(static_cast<size_tupe>(std::max(capacity, m_maximumResultCount))); bindValues(queryValues...); while (BaseStatement::next()) emplaceBackValues(resultValues); - setMaximumResultCount(resultValues.size()); + setMaximumResultCount(static_cast<std::size_t>(resultValues.size())); return resultValues; } |