<commit_before>#ifndef _MZ_SHARE_MAP_HPP_
#define _MZ_SHARE_MAP_HPP_

#include "Metazion/Share/ShareInclude.hpp"

#include "Metazion/Share/Collection/MapIterator.hpp"
#include "Metazion/Share/Collection/RBTree.hpp"
#include "Metazion/Share/Memory/HeapAllocator.hpp"

DECL_NAMESPACE_MZ_SHARE_BEGIN

template<typename KeyType
, typename ValueType
, typename CompareType
, typename AllocatorFamily = HeapAllocator<>
>
class Map {
    DISALLOW_COPY_AND_ASSIGN(Map)
    
    using Key_t = KeyType;
    using Value_t = ValueType;
    using Compare_t = CompareType;
    using Data_t = Pair<Key_t, Value_t>;
    using DataCompare_t = PairCompare<Data_t, Compare_t>;
    using Node_t = RBTreeNode<Data_t>;
    using Tree_t = RBTree<Node_t, DataCompare_t>;
    using Allocator_t = typename AllocatorFamily::template Rebind<sizeof(Node_t)>;

public:
    using Iterator_t = MapIterator<Node_t>;
    using ConstIterator_t = MapConstIterator<Node_t>;

public:
    Map() { m_allocator.Initialize(); }

    ~Map() { m_allocator.Finalize(); }

public:
    void Clear() {
        while (!IsEmpty()) {
            
        }
    }

    bool IsEmpty() const {
        return m_tree.IsEmpty();
    }

    int GetSize() const {
        return m_tree.GetSize();
    }
<commit_msg>Improve map.<commit_after>#ifndef _MZ_SHARE_MAP_HPP_
#define _MZ_SHARE_MAP_HPP_

#include "Metazion/Share/ShareInclude.hpp"

#include "Metazion/Share/Collection/MapIterator.hpp"
#include "Metazion/Share/Collection/RBTree.hpp"
#include "Metazion/Share/Memory/HeapAllocator.hpp"

DECL_NAMESPACE_MZ_SHARE_BEGIN

template<typename KeyType
, typename ValueType
, typename CompareType
, typename AllocatorFamily = HeapAllocator<>
>
class Map {
    DISALLOW_COPY_AND_ASSIGN(Map)
    
    using Key_t = KeyType;
    using Value_t = ValueType;
    using Compare_t = CompareType;
    using Data_t = Pair<Key_t, Value_t>;
    using DataCompare_t = PairCompare<Data_t, Compare_t>;
    using Node_t = RBTreeNode<Data_t>;
    using Tree_t = RBTree<Node_t, DataCompare_t>;
    using Allocator_t = typename AllocatorFamily::template Rebind<sizeof(Node_t)>;

public:
    using Iterator_t = MapIterator<Node_t>;
    using ConstIterator_t = MapConstIterator<Node_t>;

public:
    Map() { m_allocator.Initialize(); }

    ~Map() { m_allocator.Finalize(); }

public:
    void Clear() {
        while (!IsEmpty()) {
            Iterator_t iter = Begin();
            Erase(iter);
        }
    }

    bool IsEmpty() const {
        return m_tree.IsEmpty();
    }

    int GetSize() const {
        return m_tree.GetSize();
    }

{'fraction_non_alphanumeric': 0.10530421216848673, 'fraction_numerical': 0.0, 'mean_word_length': 3.6892138939670933, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7128544', 'n_tokens_mistral': 923, 'n_tokens_neox': 894, 'n_words': 167}