From 28dac3a3d3cac4525c0a8cd9d3527a169ad61482 Mon Sep 17 00:00:00 2001 From: MeanSquaredError <35379301+MeanSquaredError@users.noreply.github.com> Date: Sat, 31 Aug 2024 23:45:47 +0300 Subject: [PATCH] Make result_t::iterator default-constructible. --- include/sqlpp11/result.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/sqlpp11/result.h b/include/sqlpp11/result.h index 083b965e..564df29f 100644 --- a/include/sqlpp11/result.h +++ b/include/sqlpp11/result.h @@ -93,6 +93,11 @@ namespace sqlpp using reference = const result_row_t&; using difference_type = std::ptrdiff_t; + iterator() + : _result_ptr(nullptr), _result_row_ptr(nullptr) + { + } + iterator(db_result_t& result, result_row_t& result_row) : _result_ptr(&result), _result_row_ptr(&result_row) { @@ -110,6 +115,14 @@ namespace sqlpp bool operator==(const iterator& rhs) const { + if ((_result_row_ptr != nullptr) != (rhs._result_row_ptr != nullptr)) + { + return false; + } + if (_result_row_ptr == nullptr) + { + return true; + } return *_result_row_ptr == *rhs._result_row_ptr; }