mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 12:51:13 +08:00
Make the result_t::iterator::operator++(int) return void in order to fix a bug and preserve compatibility with C++20 ranges.
This commit is contained in:
parent
5564584799
commit
0a2765d588
@ -125,11 +125,16 @@ namespace sqlpp
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator operator++(int)
|
// It is quite difficult to implement a postfix increment operator that returns the old iterator
|
||||||
|
// because the underlying database results work in a stream fashion not allowing to return to
|
||||||
|
// previously-read rows.
|
||||||
|
//
|
||||||
|
// We need the postfix increment mostly for compatibility with C++20 ranges so we set the return
|
||||||
|
// type to "void" which is allowed for C++20 range iterators.
|
||||||
|
//
|
||||||
|
void operator++(int)
|
||||||
{
|
{
|
||||||
auto previous_it = *this;
|
++*this;
|
||||||
_result.next(_result_row.get());
|
|
||||||
return previous_it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::reference_wrapper<db_result_t> _result;
|
std::reference_wrapper<db_result_t> _result;
|
||||||
|
Loading…
Reference in New Issue
Block a user