Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

add KV Table iterator bool operator #997

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libraries/eosiolib/contracts/eosio/key_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ namespace internal {
return eosio::key_type{(char*)buffer, actual_value_size};
}

bool valid() const { return itr_stat == status::iterator_ok; }

protected:
uint32_t itr;
status itr_stat;
Expand Down Expand Up @@ -569,6 +571,10 @@ class table : internal::table_base {
bool operator>=(const iterator& b) const {
return base_iterator::compare(b) >= 0;
}

explicit operator bool() const {
return this->valid();
}
};

class reverse_iterator : public base_iterator {
Expand Down