From 8508a246bbfb8f782ecbbd37dd40966ad717cc3d Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Tue, 21 Apr 2015 20:33:29 -0400 Subject: [PATCH] sstable: convenient view for types Signed-off-by: Glauber Costa --- sstables/types.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sstables/types.hh b/sstables/types.hh index e2f2eb7bf5..85b81634d7 100644 --- a/sstables/types.hh +++ b/sstables/types.hh @@ -18,6 +18,9 @@ namespace sstables { template struct disk_string { bytes value; + explicit operator bytes_view() const { + return value; + } }; template @@ -51,12 +54,20 @@ struct index_entry { disk_string key; uint64_t position; disk_string promoted_index; + + explicit operator bytes_view() const { + return bytes_view(key); + } }; struct summary_entry { bytes key; uint64_t position; + explicit operator bytes_view() const { + return key; + } + bool operator==(const summary_entry& x) const { return position == x.position && key == x.key; }