Warning, /plasma/aura-browser/app/third-party/hashset-cpp/README.md is written in an unsupported language. File is not indexed.
0001 # Hash Set
0002
0003 [](https://travis-ci.org/bbondy/hashset-cpp)
0004
0005 Implements a simple HashSet for strings in environments where you don't have the std lib available.
0006 You should probably not be using this. Instead consider using `hash_set` which is a more generic implementation with templates.
0007 This is only useful for very specific use cases having specific memory layout requirements.
0008
0009 ## Setup
0010
0011 ```
0012 npm install --save hashset-cpp
0013 ```
0014
0015 ## Sample
0016
0017 ```c++
0018 #include <iostream>
0019 #include "hash_set.h"
0020 #include "test/example_data.h"
0021
0022 using std::cout;
0023 using std::endl;
0024
0025 int main(int argc, char **argv) {
0026 // Bucket size is 256 and don't allow multiple items per item hash.
0027 HashSet<ExampleData> set(256, false);
0028 set.Add(ExampleData("test"));
0029
0030 // Prints true
0031 cout << "test exists: " << (set.Exists(ExampleData("test"))
0032 ? "true" : "false") << endl;
0033 // Prints false
0034 cout << "test2 exists: " << (set.Exists(ExampleData("test2"))
0035 ? "true" : "false") << endl;
0036
0037 uint32_t len;
0038 char * buffer = set.Serialize(&len);
0039 HashSet<ExampleData> set2(0, false);
0040 set2.Deserialize(buffer, len);
0041 // Prints true
0042 cout << "test exists: " << (set2.Exists(ExampleData("test"))
0043 ? "true" : "false") << endl;
0044 // Prints false
0045 cout << "test2 exists: " << (set2.Exists(ExampleData("test2"))
0046 ? "true" : "false") << endl;
0047
0048 delete[] buffer;
0049 return 0;
0050 }
0051 ```
0052
0053 ## Build everything in release
0054
0055 ```
0056 make
0057 ```
0058
0059 ## Running sample
0060
0061 ```
0062 make sample
0063 ```
0064
0065 ## Running tests
0066
0067 ```
0068 make test
0069 ```
0070
0071 ## Clearing build files
0072 ```
0073 make clean
0074 ```
0075
0076 ## Linting
0077 ```
0078 npm run lint
0079 ```