#include <unordered_map>
#include <cstdint>
#include <stdexcept>
Go to the source code of this file.
◆ cpp_add_entry_umap()
| void cpp_add_entry_umap |
( |
void * | umap_ptr, |
|
|
int | key, |
|
|
int | value ) |
|
noexcept |
Definition at line 46 of file umap.cpp.
46 {
47
48
49 auto umap = static_cast<std::unordered_map<int,int>*>(umap_ptr);
50 (*umap)[key] = value;
51}
◆ cpp_create_umap()
| void * cpp_create_umap |
( |
| ) |
|
|
noexcept |
Definition at line 33 of file umap.cpp.
33 {
34
35 auto* umap = new std::unordered_map<int,int>();
36 return static_cast<void*>(umap);
37}
◆ cpp_free_umap()
| void cpp_free_umap |
( |
void * | umap_ptr | ) |
|
|
noexcept |
Definition at line 39 of file umap.cpp.
39 {
40
41
42 auto umap = static_cast<std::unordered_map<int,int>*>(umap_ptr);
43 delete umap;
44}
◆ cpp_get_value_umap()
| int cpp_get_value_umap |
( |
void * | umap_ptr, |
|
|
int | key, |
|
|
int | default_value ) |
|
noexcept |
Definition at line 53 of file umap.cpp.
53 {
54
55
56 auto umap = static_cast<std::unordered_map<int,int>*>(umap_ptr);
57 auto it = umap->find(key);
58 return (it != umap->end()) ? it->second : default_value;
59}
◆ cpp_reserve_umap()
| void cpp_reserve_umap |
( |
void * | umap_ptr, |
|
|
std::size_t | n ) |
|
noexcept |
Definition at line 61 of file umap.cpp.
61 {
62
63
64
65 auto umap = static_cast<std::unordered_map<int,int>*>(umap_ptr);
67}