Massively overengineered logger to support different character types.

This commit is contained in:
2025-06-21 14:16:19 +02:00
parent 061c58ef41
commit b91eb34789
9 changed files with 621 additions and 157 deletions

View File

@@ -7,6 +7,7 @@
#include <algorithm>
#include <stdexcept>
#include <vector>
#include "./boxed_object.hpp"
#include "./optional.hpp"
@@ -102,7 +103,7 @@ public:
}
};
template<typename TKey, typename TValue, typename TKeyAllocator = std::allocator<TKey>, typename TValueAllocator = std::allocator<TValue>>
template<typename TKey, typename TValue, typename TKeyAllocator = MIJIN_DEFAULT_ALLOCATOR<TKey>, typename TValueAllocator = MIJIN_DEFAULT_ALLOCATOR<TValue>>
class VectorMap
{
public:
@@ -119,12 +120,17 @@ private:
std::vector<TKey, TKeyAllocator> keys_;
std::vector<TValue, TValueAllocator> values_;
public:
VectorMap() noexcept = default;
explicit VectorMap(TKeyAllocator keyAllocator = {})
MIJIN_NOEXCEPT_IF((std::is_nothrow_move_constructible_v<TKeyAllocator> && std::is_nothrow_constructible_v<TValueAllocator, const TKeyAllocator&>))
: keys_(std::move(keyAllocator)), values_(TValueAllocator(keys_.get_allocator())) {}
VectorMap(TKeyAllocator keyAllocator, TValueAllocator valueAllocator)
MIJIN_NOEXCEPT_IF(std::is_nothrow_move_constructible_v<TKeyAllocator> && std::is_nothrow_move_constructible_v<TValueAllocator>)
: keys_(std::move(keyAllocator)), values_(std::move(valueAllocator)) {}
VectorMap(const VectorMap&) = default;
VectorMap(VectorMap&&) MIJIN_NOEXCEPT = default;
VectorMap(VectorMap&&) = default;
VectorMap& operator=(const VectorMap&) = default;
VectorMap& operator=(VectorMap&&) MIJIN_NOEXCEPT = default;
VectorMap& operator=(VectorMap&&) = default;
auto operator<=>(const VectorMap& other) const noexcept = default;
TValue& operator[](const TKey& key)