diff --git a/src/lib/diff/index-table.hpp b/src/lib/diff/index-table.hpp index 292584fd3..c96df8a26 100644 --- a/src/lib/diff/index-table.hpp +++ b/src/lib/diff/index-table.hpp @@ -76,11 +76,19 @@ namespace diff{ } } - size_t - size() const - { - return data_.size(); - } + /* === forwarded sequence access === */ + + using iterator = typename std::vector::iterator; + using const_iterator = typename std::vector::const_iterator; + + iterator begin() { return data_.begin(); } + iterator end() { return data_.end(); } + const_iterator begin() const { return data_.begin(); } + const_iterator end() const { return data_.end(); } + + size_t size() const { return data_.size(); } + + VAL const& diff --git a/tests/library/diff/diff-index-table-test.cpp b/tests/library/diff/diff-index-table-test.cpp index bb1139e8f..36ca475cb 100644 --- a/tests/library/diff/diff-index-table-test.cpp +++ b/tests/library/diff/diff-index-table-test.cpp @@ -78,6 +78,7 @@ namespace test{ { simpleUsage(); verifySnapshot(); + sequenceIteration(); duplicateDetection(); copy_and_move(); } @@ -144,6 +145,19 @@ namespace test{ } + void + sequenceIteration() + { + DataSeq data({a5,a2,a1,a4,a3}); + + size_t i = 0; + for (auto elm : Index(data)) + { + CHECK (elm == data[i++]); + } + } + + void duplicateDetection() {