<commit_before>#pragma once

#include "../feature.hpp"

#include "../../std/map.hpp"


namespace stats
{
  struct GeneralInfo
  {
    uint64_t m_count, m_size;

    GeneralInfo() : m_count(0), m_size(0) {}

    void Add(uint64_t sz)
    {
      if (sz > 0)
      {
        ++m_count;
        m_size += sz;
      }
    }
  };

  template <class TKey>
  struct GeneralInfoKey
  {
    TKey m_key;
    GeneralInfo m_info;

    GeneralInfoKey(TKey key) : m_key(key) {}

    bool operator< (GeneralInfoKey const & rhs) const
    {
      return m_key < rhs.m_key;
    }
  };

  struct TypeTag
  {
    uint32_t m_val;

    TypeTag(uint32_t v) : m_val(v) {}

    bool operator< (TypeTag const & rhs) const
    {
      return m_val < rhs.m_val;
    }
  };

  struct MapInfo
  {
    set<GeneralInfoKey<FeatureBase::FeatureType> > m_byGeomType;
    set<GeneralInfoKey<TypeTag> > m_byClassifType;
    set<GeneralInfoKey<uint32_t> > m_byPointsCount;

    GeneralInfo m_all, m_names, m_types;

    template <class TKey, class TSet>
    void AddToSet(TKey key, uint32_t sz, TSet & theSet)
    {
      theSet.insert(GeneralInfoKey<TKey>(key)).first->m_info.Add(sz);
    }
  };

  void CalcStatistic(string const & fName, MapInfo & info);
  void PrintStatistic(MapInfo & info);
}<commit_msg>GCC build fix<commit_after>#pragma once

#include "../feature.hpp"

#include "../../std/map.hpp"


namespace stats
{
  struct GeneralInfo
  {
    uint64_t m_count, m_size;

    GeneralInfo() : m_count(0), m_size(0) {}

    void Add(uint64_t sz)
    {
      if (sz > 0)
      {
        ++m_count;
        m_size += sz;
      }
    }
  };

  template <class TKey>
  struct GeneralInfoKey
  {
    TKey m_key;
    GeneralInfo m_info;

    GeneralInfoKey(TKey key) : m_key(key) {}

    bool operator< (GeneralInfoKey const & rhs) const
    {
      return m_key < rhs.m_key;
    }
  };

  struct TypeTag
  {
    uint32_t m_val;

    TypeTag(uint32_t v) : m_val(v) {}

    bool operator< (TypeTag const & rhs) const
    {
      return m_val < rhs.m_val;
    }
  };

  struct MapInfo
  {
    set<GeneralInfoKey<FeatureBase::FeatureType> > m_byGeomType;
    set<GeneralInfoKey<TypeTag> > m_byClassifType;
    set<GeneralInfoKey<uint32_t> > m_byPointsCount;

    GeneralInfo m_all, m_names, m_types;

    template <class TKey, class TSet>
    void AddToSet(TKey key, uint32_t sz, TSet & theSet)
    {
      // GCC doesn't allow to modify set value ...
      const_cast<GeneralInfo &>(
          theSet.insert(GeneralInfoKey<TKey>(key)).first->m_info).Add(sz);
    }
  };

  void CalcStatistic(string const & fName, MapInfo & info);
  void PrintStatistic(MapInfo & info);
}
{'fraction_non_alphanumeric': 0.12106261859582543, 'fraction_numerical': 0.011385199240986717, 'mean_word_length': 2.62585969738652, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 26, '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': '4651008', 'n_tokens_mistral': 1016, 'n_tokens_neox': 973, 'n_words': 202}