Name: hashset-cpp
Owner: Brave Software
Description: Simple hashtable implementation with easy serialization and deserialization
Created: 2016-01-21 22:00:27.0
Updated: 2018-03-25 02:13:02.0
Pushed: 2018-03-25 02:13:01.0
Homepage: null
Size: 47
Language: C++
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Implements a simple HashSet for strings in environments where you don't have the std lib available.
You should probably not be using this. Instead consider using hash_set
which is a more generic implementation with templates.
This is only useful for very specific use cases having specific memory layout requirements.
install --save hashset-cpp
lude <iostream>
lude "HashSet.h"
lude "test/exampleData.h"
g std::cout;
g std::endl;
main(int argc, char **argv) {
shSet<ExampleData> set(256);
t.add(ExampleData("test"));
Prints true
ut << "test exists: " << (set.exists(ExampleData("test"))
? "true" : "false") << endl;
Prints false
ut << "test2 exists: " << (set.exists(ExampleData("test2"))
? "true" : "false") << endl;
nt32_t len;
ar * buffer = set.serialize(&len);
shSet<ExampleData> set2(0);
t2.deserialize(buffer, len);
Prints true
ut << "test exists: " << (set2.exists(ExampleData("test"))
? "true" : "false") << endl;
Prints false
ut << "test2 exists: " << (set2.exists(ExampleData("test2"))
? "true" : "false") << endl;
lete[] buffer;
turn 0;
sample
test
clean
run lint