allow for iterative access to the snapshot data in the lookup table

This commit is contained in:
Fischlurch 2015-01-04 14:23:12 +01:00
parent a8d1cd9c8b
commit a12a739f05
2 changed files with 27 additions and 5 deletions

View file

@ -76,11 +76,19 @@ namespace diff{
}
}
size_t
size() const
{
return data_.size();
}
/* === forwarded sequence access === */
using iterator = typename std::vector<VAL>::iterator;
using const_iterator = typename std::vector<VAL>::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&

View file

@ -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()
{