From ae6b677f9abddcd8a95eaab3c8ac804ebe4b9a07 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 8 Apr 2021 13:49:01 +0300 Subject: [PATCH] partition_snapshot_row-cursor: Add const consume_row() version It's the same as the existing one, but doesn't modify anything (cursor and pointing rows_entry's) and calls consumer with const row reference. Signed-off-by: Pavel Emelyanov --- partition_snapshot_row_cursor.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/partition_snapshot_row_cursor.hh b/partition_snapshot_row_cursor.hh index 8807ecf9ba..571ebd3c7a 100644 --- a/partition_snapshot_row_cursor.hh +++ b/partition_snapshot_row_cursor.hh @@ -371,6 +371,15 @@ public: } } + // Can be called only when cursor is valid and pointing at a row. + template + requires std::is_invocable_v + void consume_row(Consumer&& consumer) const { + for (const position_in_version& v : _current_row) { + consumer(v.it->row()); + } + } + // Returns memory footprint of row entries under the cursor. // Can be called only when cursor is valid and pointing at a row. size_t memory_usage() const {