# hashset-cpp

> [![Build Status](https://travis-ci.org/bbondy/hashset-cpp.svg?branch=master)](https://travis-ci.org/bbondy/hashset-cpp)

Latest version **2.2.1** (published 2019-07-22) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install hashset-cpp
pnpm add hashset-cpp
yarn add hashset-cpp
bun add hashset-cpp
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2019-07-22 |
| First published | 2015-11-10 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | Brian R. Bondy |
| Maintainers | brianbondy |

## Links

- npm: https://www.npmjs.com/package/hashset-cpp
- Repository: https://github.com/bbondy/hashset-cpp
- Homepage: https://github.com/bbondy/hashset-cpp#readme
- Issues: https://github.com/bbondy/hashset-cpp/issues
- npm.io page: https://npm.io/package/hashset-cpp

## Recent versions

- 2.2.1 (latest) — 2019-07-22
- 2.2.0 — 2019-07-21
- 2.1.1 — 2019-05-08
- 2.1.0 — 2018-06-27
- 2.0.2 — 2018-06-15
- 2.0.1 — 2018-04-10
- 1.0.18 — 2017-11-04
- 2.0.0 — 2017-06-28
- 1.0.17 — 2016-10-03
- 1.0.16 — 2016-07-28
- 1.0.15 — 2016-03-31
- 1.0.14 — 2016-03-31
- 1.0.13 — 2016-01-06
- 1.0.12 — 2016-01-06
- 1.0.11 — 2016-01-04
- … 21 more at https://npm.io/package/hashset-cpp/versions

## README

# Hash Set

[![Build Status](https://travis-ci.org/bbondy/hashset-cpp.svg?branch=master)](https://travis-ci.org/bbondy/hashset-cpp)

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.

## Setup

```
npm install --save hashset-cpp
```

## Sample

```c++
#include <iostream>
#include "hash_set.h"
#include "test/example_data.h"

using std::cout;
using std::endl;

int main(int argc, char **argv) {
  // Bucket size is 256 and don't allow multiple items per item hash.
  HashSet<ExampleData> set(256, false);
  set.Add(ExampleData("test"));

  // Prints true
  cout << "test exists: " << (set.Exists(ExampleData("test"))
      ? "true" : "false") << endl;
  // Prints false
  cout << "test2 exists: " << (set.Exists(ExampleData("test2"))
      ? "true" : "false") << endl;

  uint32_t len;
  char * buffer = set.Serialize(&len);
  HashSet<ExampleData> set2(0, false);
  set2.Deserialize(buffer, len);
  // Prints true
  cout << "test exists: " << (set2.Exists(ExampleData("test"))
      ? "true" : "false") << endl;
  // Prints false
  cout << "test2 exists: " << (set2.Exists(ExampleData("test2"))
      ? "true" : "false") << endl;

  delete[] buffer;
  return 0;
}
```

## Build everything in release

```
make
```

## Running sample

```
make sample
```

## Running tests

```
make test
```

## Clearing build files
```
make clean
```

## Linting
```
npm run lint
```

---
_Source: https://npm.io/package/hashset-cpp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
