From 3bfec0187a037389b011b0a374a741995921a185 Mon Sep 17 00:00:00 2001 From: andrei-datcu Date: Mon, 15 Mar 2021 12:55:41 +0200 Subject: [PATCH 1/2] Use constant references when iterating over ranges in replace_range / insert_range --- include/sqlite_orm/sqlite_orm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index 22c493422..d42ac9dae 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -12358,7 +12358,7 @@ namespace sqlite_orm { auto stmt = statement.stmt; sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - auto &o = *it; + const auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { using column_type = typename std::decay::type; using field_type = typename column_type::field_type; @@ -12399,7 +12399,7 @@ namespace sqlite_orm { auto &tImpl = this->get_impl(); sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - auto &o = *it; + const auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { if(!c.template has>()) { using column_type = typename std::decay::type; From c4c67d2361122cd2c43e35cd93009d0e105cb5c4 Mon Sep 17 00:00:00 2001 From: andrei-datcu Date: Mon, 15 Mar 2021 13:02:59 +0200 Subject: [PATCH 2/2] Update sqlite_orm.h --- include/sqlite_orm/sqlite_orm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index d42ac9dae..45c43a32b 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -12399,7 +12399,7 @@ namespace sqlite_orm { auto &tImpl = this->get_impl(); sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - const auto &o = *it; + auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { if(!c.template has>()) { using column_type = typename std::decay::type;