<commit_before>#ifndef MIMOSA_TRIE_HH
# define MIMOSA_TRIE_HH

# include <functional>

# include "string-ref.hh"

namespace mimosa
{
  /**
   * @param Value must be a pointer type or a smart pointer
   */
  template <typename Value, StringRef (*GetKey)(Value value)>
  class Trie
  {
  public:
    inline Trie(uint32_t depth = 0);
    inline ~Trie();

    inline bool insert(const Value & value) { return insert(GetKey(value), value); }
    inline Value find(const StringRef & key) const;
    inline void erase(const StringRef & key);

    inline void clear();
    inline bool empty() const { return !size_; }<commit_msg>Trie: add an helper for erase()<commit_after>#ifndef MIMOSA_TRIE_HH
# define MIMOSA_TRIE_HH

# include <functional>

# include "string-ref.hh"

namespace mimosa
{
  /**
   * @param Value must be a pointer type or a smart pointer
   */
  template <typename Value, StringRef (*GetKey)(Value value)>
  class Trie
  {
  public:
    inline Trie(uint32_t depth = 0);
    inline ~Trie();

    inline bool insert(const Value & value) { return insert(GetKey(value), value); }
    inline Value find(const StringRef & key) const;
    inline void erase(const StringRef & key);
    inline void erase(const Value & value) { erase(GetKey(value)); }

    inline void clear();
    inline bool empty() const { return !size_; }
{'fraction_non_alphanumeric': 0.11060948081264109, 'fraction_numerical': 0.004514672686230248, 'mean_word_length': 3.6996466431095407, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5236425', 'n_tokens_mistral': 432, 'n_tokens_neox': 416, 'n_words': 139}