1#include <gtest/gtest.h>
251 map[1.5] =
"one-half";
252 map[2.5] =
"two-half";
286 map.
insert(-1,
"minus-one");
287 map.
insert(-10,
"minus-ten");
302 for (
int i = 0; i <
N; ++i)
307 for (
int i = 0; i <
N; ++i)
318 for (
int i = 0; i < 500; ++i)
319 map.
insert(i, std::to_string(i));
323 for (
int i = 0; i < 500; i += 10)
331 for (
int i = 0; i < 100; ++i)
332 map.
insert(i, std::to_string(i));
334 for (
int i = 0; i < 100; i += 2)
339 for (
int i = 1; i < 100; i += 2)
347 for (
int i = 0; i < 200; ++i)
348 map.
insert(i,
"val_" + std::to_string(i));
354 for (
int i = 0; i < 200; i += 10)
356 std::string key =
"val_" + std::to_string(i);
Bidirectional mapping between two types.
TEST_F(AHMappingTest, DefaultConstructor)
A generic key-value mapping container with inverse operation support.
bool remove(const Key &key) noexcept
Removes the key-value pair with the given key.
size_t size() const noexcept
Gets the number of key-value pairs in the mapping.
bool valid_key(const Key &key) const noexcept
Checks if a key exists in the mapping.
AHMapping< ValueType, Key > inverse() const
Creates a new mapping with keys and values swapped.
bool contains_value(const ValueType &value) const
Checks if the mapping contains a specific value.
void insert(const Key &key, const ValueType &value)
Inserts or updates a key-value pair in the mapping.
void for_each(F f) const
Applies a function to each key-value pair.
void clear() noexcept
Removes all key-value pairs from the mapping.
bool empty() const noexcept
Checks if the mapping is empty.
T & insert(const T &item)
Insert a new item by copy.
void empty() noexcept
empty the list
size_t size() const noexcept
Count the number of elements of the list.
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.