Files
conan-center-index/recipes/parlayhash/all/test_package/test_package.cpp
Fernando Pelliccioni 6cdc34101b parlayhash: add new new recipe (#22638)
* ParlayHash: new recipe

* fix linting

* Update recipes/parlay_hash/all/conanfile.py

Co-authored-by: toge <toge.mail@gmail.com>

* fix

* fix test_package

* Update recipes/parlay_hash/all/test_package/test_package.cpp

Co-authored-by: toge <toge.mail@gmail.com>

* Update recipes/parlay_hash/all/conanfile.py

Co-authored-by: toge <toge.mail@gmail.com>

* WOrk for v0.1

* remove temp files

* fix

* Follow upstream target names

* Typo

* Cleanups and support specific macos version, remove msvc support

* Skip Linux Clang as well

Signed-off-by: Uilian Ries <uilianries@gmail.com>

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: toge <toge.mail@gmail.com>
Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
2025-02-27 12:09:40 +00:00

25 lines
754 B
C++

#include <iostream>
#include <string>
#include <parlay/parallel.h>
#include "parlay_hash/unordered_map.h"
using K = std::string;
using V = unsigned long;
using map_type = parlay::parlay_unordered_map<K,V>;
int main() {
map_type my_map(100);
my_map.Insert("sue", 1);
my_map.Insert("sam", 5);
std::cout << "value before increment: " << *my_map.Find("sue") << std::endl;
auto increment = [] (std::optional<V> v) -> V {return v.has_value() ? 1 + *v : 1;};
my_map.Upsert("sue", increment);
std::cout << "value after increment: " << *my_map.Find("sue") << std::endl;
std::cout << "size before remove: " << my_map.size() << std::endl;
my_map.Remove("sue");
std::cout << "size after remove: " << my_map.size() << std::endl;
return 0;
}