Skip to content

Commit

Permalink
Make result_t::iterator default-constructible.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeanSquaredError authored and rbock committed Sep 3, 2024
1 parent 5224d6a commit 28dac3a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/sqlpp11/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}

Expand Down

0 comments on commit 28dac3a

Please sign in to comment.