Some documentation

This commit is contained in:
TinyAtoms
2020-02-18 00:00:25 -03:00
parent b82199e3b0
commit 94b7399926
39 changed files with 87 additions and 8900 deletions

View File

@@ -28,11 +28,17 @@
using std::string;
using absl::Hash;
// this is the prepare function, again using template
// this is for all maps which only need this. Below are the ones that
// need something different
template<class T>
void prepare(T& map, int size) {
map.reserve(size);
}
// needs a tombstone marker(a key that's exclusively used to signify something
// is deleted) and it doesn't have a reserve(size) member
void prepare(google::sparse_hash_map<int, int>& map, int size) {
map.set_deleted_key(-1);
}
@@ -41,6 +47,10 @@ void prepare(google::sparse_hash_map<string, string>& map, int size) {
map.set_deleted_key("a");
}
// needs a tombstone marker(a key that's exclusively used to signify something
// is deleted) and an empty key marker
// and it doesn't have a reserve(size) member
void prepare(google::dense_hash_map<int, int>& map, int size) {
map.set_empty_key(0);
map.set_deleted_key(-1);
@@ -51,7 +61,9 @@ void prepare(google::dense_hash_map<string, string>& map, int size) {
map.set_empty_key("");
}
// with abseil hash
// this is a repeat of the 4 written above, but with types that accept abseil::Hash as hashing function
void prepare(google::sparse_hash_map<int, int, Hash<int>>& map, int size) {
map.set_deleted_key(-1);
}