Skip to content

Commit

Permalink
slot_map : Review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Groarke committed May 19, 2019
1 parent 830fe7a commit 4c37e82
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
11 changes: 0 additions & 11 deletions SG14/slot_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,6 @@ class slot_map
return *value_iter;
}

// The at_unchecked() function has no checks whatsoever
// and does not throw.
// O(1) time and space complexity.
//
constexpr reference at_unchecked(const key_type& key) {
return *find_unchecked(key);
}
constexpr const_reference at_unchecked(const key_type& key) const {
return *find_unchecked(key);
}

// The bracket operator[] has a generation counter check
// and does not throw.
// If the check fails it is undefined behavior.
Expand Down
3 changes: 0 additions & 3 deletions SG14_test/slot_map_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,11 @@ static void BasicTests(T t1, T t2)
assert(sm.find_unchecked(k1) == sm.begin());
assert(sm[k1] == *sm.begin());
assert(sm.at(k1) == *sm.begin());
assert(sm.at_unchecked(k1) == *sm.begin());

assert(sm.find(k2) == std::next(sm.begin()));
assert(sm.find_unchecked(k2) == std::next(sm.begin()));
assert(sm[k2] == *std::next(sm.begin()));
assert(sm.at(k2) == *std::next(sm.begin()));
assert(sm.at_unchecked(k2) == *std::next(sm.begin()));

assert(sm2.empty());
assert(sm2.size() == 0);
Expand All @@ -193,7 +191,6 @@ static void BasicTests(T t1, T t2)
assert(sm2.find_unchecked(k2) == sm2.begin()); // find a non-expired key
assert(sm2[k2] == *sm2.begin()); // find a non-expired key
assert(sm2.at(k2) == *sm2.begin()); // find a non-expired key
assert(sm2.at_unchecked(k2) == *sm2.begin()); // find a non-expired key

assert(sm2.erase(k1) == 0); // erase an expired key
}
Expand Down

0 comments on commit 4c37e82

Please sign in to comment.