<commit_before>#ifndef NAMED_TUPLES_CONST_STRING_HEADER
#define NAMED_TUPLES_CONST_STRING_HEADER
#include <cstddef>
#include "type_traits.hpp"

namespace named_tuples {

using str_id_type = unsigned long long;

unsigned constexpr const_str_size(char const *input) {
  return *input ?  1u + const_str_size(input + 1) : 0;
}

unsigned constexpr const_hash(char const *input) {
  return *input ?  static_cast<unsigned int>(*input) + 33 * const_hash(input + 1) : 5381;
}

class const_string {
  const char * data_;
  std::size_t size_;
 public:
  template<std::size_t N> constexpr const_string(const char(&data)[N]) : data_(data), size_(N-1) {}
  constexpr const_string(const char * data) : data_(data), size_(const_str_size(data)) {}
  constexpr const_string(const char * data, std::size_t size) : data_(data), size_(size) {}
  constexpr char operator[](std::size_t n) const {
    return n < size_ ? data_[n] : throw std::out_of_range("");
  }
  constexpr std::size_t size() const { return size_; }
  constexpr char const* str() const { return data_; }
  constexpr operator unsigned() const { return const_hash(data_); }
};

//#ifdef NAMED_TUPLES_CPP14

template <char Value> struct constexpr_char {
  static constexpr char value = Value;
};

template <char ... Chars> class constexpr_string {
  //using char_list = type_list<Chars ..., '\0'>;
  using char_list = type_list<constexpr_char<Chars> ..., constexpr_char<'\0'>>;
  const char data_[sizeof ... (Chars) + 1u];
  const size_t size_;
 public:
  constexpr constexpr_string() : data_ {Chars..., '\0'}, size_(index_of<char_list, constexpr_char<'\0'>>()) {}
  constexpr char const* str() const { return data_; }
  constexpr size_t size() const { return size_; }
  constexpr char operator[] (size_t index) const { return data_[index]; }
};


// Trait to cut out null chars at the end
template <typename String, char ... Chars> struct strip_null_impl;
// Non-const version
template <char ... Head, char Current, char ... Tail> struct strip_null_impl<constexpr_string<Head ...>, Current, Tail ...>  {
  using type = typename std::conditional<
    Current == '\0'
    , typename strip_null_impl<constexpr_string<Head ...>, Tail ...>::type
    , typename strip_null_impl<constexpr_string<Head ..., Current>, Tail ...>::type>::type;
};
template <char ... T> struct strip_null_impl<constexpr_string<T ...>> {
  using type = constexpr_string<T ...>;
};

template <typename String> struct strip_null;
template <char ... T> struct strip_null<constexpr_string<T ...>> {
  using type = typename strip_null_impl<constexpr_string<>, T ...>::type;
};
// Const version
template <char ... Head, char Current, char ... Tail> struct strip_null_impl<const constexpr_string<Head ...>, Current, Tail ...>  {
  using type = typename std::conditional<
    Current == '\0'
    , typename strip_null_impl<const constexpr_string<Head ...>, Tail ...>::type
    , typename strip_null_impl<const constexpr_string<Head ..., Current>, Tail ...>::type>::type;
};
template <char ... T> struct strip_null_impl<const constexpr_string<T ...>> {
  using type = const constexpr_string<T ...>;
};
template <char ... T> struct strip_null<const constexpr_string<T ...>> {
  using type = typename strip_null_impl<const constexpr_string<>, T ...>::type;
};


template <typename ... Strings> struct concat_impl;

template <typename Head, typename ... Tail> struct concat_impl<Head, Tail...> {
  using type = typename concat_impl<Head, typename concat_impl<Tail...>::type>::type;
};

template <> struct concat_impl<> {
  using type = constexpr_string<>;
};

template <char ... Chars1, char ... Chars2> struct concat_impl<const constexpr_string<Chars1...>, const constexpr_string<Chars2...>> {
  using type = const constexpr_string<Chars1..., Chars2...>;
};
template <char ... Chars1, char ... Chars2> struct concat_impl<constexpr_string<Chars1...>, constexpr_string<Chars2...>> {
  using type = constexpr_string<Chars1..., Chars2...>;
};

template <typename ... Strings> struct concat {
  using type = typename concat_impl<typename strip_null<Strings>::type...>::type;
};

//template <typename ... Strings> struct concat {
  //using str_type = typename concat_impl<Strings ...>::str_type;
//};

//template <char ... Chars> struct concat<const constexpr_string<Chars...>> {
  //using str_type = const constexpr_string<Chars...>;
//}; 

//template <char ... Chars> struct concat<constexpr_string<Chars...>> {
  //using str_type = constexpr_string<Chars...>;
//}; 
//template <> struct concat<> {
  //using str_type = const constexpr_string<>;
//};

template <unsigned long long Value> class str8_rep {
  const constexpr_string<
      static_cast<char>(0xff & Value),
      static_cast<char>((0xff00 & Value) >> 8llu),
      static_cast<char>((0xff0000 & Value) >> 16llu),
      static_cast<char>((0xff000000 & Value) >> 24llu),
      static_cast<char>((0xff00000000 & Value) >> 32llu),
      static_cast<char>((0xff0000000000 & Value) >> 40llu),
      static_cast<char>((0xff000000000000 & Value) >> 48llu),
      static_cast<char>((0xff00000000000000 & Value) >> 56llu)
  > str_impl_;

 public:<commit_msg>Code cleaning<commit_after>#ifndef NAMED_TUPLES_CONST_STRING_HEADER
#define NAMED_TUPLES_CONST_STRING_HEADER
#include <cstddef>
#include "type_traits.hpp"

namespace named_tuples {

using str_id_type = unsigned long long;

size_t constexpr const_str_size(char const *input) {
  return *input ?  1u + const_str_size(input + 1) : 0;
}

str_id_type constexpr const_hash(char const *input) {
  return *input ?  static_cast<str_id_type>(*input) + 33 * const_hash(input + 1) : 5381;
}

class const_string {
  const char * data_;
  std::size_t size_;
 public:
  template<std::size_t N> constexpr const_string(const char(&data)[N]) : data_(data), size_(N-1) {}
  constexpr const_string(const char * data) : data_(data), size_(const_str_size(data)) {}
  constexpr const_string(const char * data, std::size_t size) : data_(data), size_(size) {}
  constexpr char operator[](std::size_t n) const {
    return n < size_ ? data_[n] : throw std::out_of_range("");
  }
  constexpr std::size_t size() const { return size_; }
  constexpr char const* str() const { return data_; }
  constexpr operator str_id_type() const { return const_hash(data_); }
};

//#ifdef NAMED_TUPLES_CPP14

template <char Value> struct constexpr_char {
  static constexpr char value = Value;
};

template <char ... Chars> class constexpr_string {
  using char_list = type_list<constexpr_char<Chars> ..., constexpr_char<'\0'>>;
  const char data_[sizeof ... (Chars) + 1u];
  const size_t size_;
 public:
  constexpr constexpr_string() : data_ {Chars..., '\0'}, size_(index_of<char_list, constexpr_char<'\0'>>()) {}
  constexpr char const* str() const { return data_; }
  constexpr size_t size() const { return size_; }
  constexpr char operator[] (size_t index) const { return data_[index]; }
};


// Trait to cut out null chars at the end
template <typename String, char ... Chars> struct strip_null_impl;
// Non-const version
template <char ... Head, char Current, char ... Tail> struct strip_null_impl<constexpr_string<Head ...>, Current, Tail ...>  {
  using type = typename std::conditional<
    Current == '\0'
    , typename strip_null_impl<constexpr_string<Head ...>, Tail ...>::type
    , typename strip_null_impl<constexpr_string<Head ..., Current>, Tail ...>::type>::type;
};
template <char ... T> struct strip_null_impl<constexpr_string<T ...>> {
  using type = constexpr_string<T ...>;
};

template <typename String> struct strip_null;
template <char ... T> struct strip_null<constexpr_string<T ...>> {
  using type = typename strip_null_impl<constexpr_string<>, T ...>::type;
};
// Const version
template <char ... Head, char Current, char ... Tail> struct strip_null_impl<const constexpr_string<Head ...>, Current, Tail ...>  {
  using type = typename std::conditional<
    Current == '\0'
    , typename strip_null_impl<const constexpr_string<Head ...>, Tail ...>::type
    , typename strip_null_impl<const constexpr_string<Head ..., Current>, Tail ...>::type>::type;
};
template <char ... T> struct strip_null_impl<const constexpr_string<T ...>> {
  using type = const constexpr_string<T ...>;
};
template <char ... T> struct strip_null<const constexpr_string<T ...>> {
  using type = typename strip_null_impl<const constexpr_string<>, T ...>::type;
};

// Traits for concatenating strings
template <typename ... Strings> struct concat_impl;
template <typename Head, typename ... Tail> struct concat_impl<Head, Tail...> {
  using type = typename concat_impl<Head, typename concat_impl<Tail...>::type>::type;
};
template <> struct concat_impl<> {
  using type = constexpr_string<>;
};
template <char ... Chars1, char ... Chars2> struct concat_impl<const constexpr_string<Chars1...>, const constexpr_string<Chars2...>> {
  using type = const constexpr_string<Chars1..., Chars2...>;
};
template <char ... Chars1, char ... Chars2> struct concat_impl<constexpr_string<Chars1...>, constexpr_string<Chars2...>> {
  using type = constexpr_string<Chars1..., Chars2...>;
};
template <typename ... Strings> struct concat {
  using type = typename concat_impl<typename strip_null<Strings>::type...>::type;
};


template <unsigned long long Value> class str8_rep {
  const constexpr_string<
      static_cast<char>(0xff & Value),
      static_cast<char>((0xff00 & Value) >> 8llu),
      static_cast<char>((0xff0000 & Value) >> 16llu),
      static_cast<char>((0xff000000 & Value) >> 24llu),
      static_cast<char>((0xff00000000 & Value) >> 32llu),
      static_cast<char>((0xff0000000000 & Value) >> 40llu),
      static_cast<char>((0xff000000000000 & Value) >> 48llu),
      static_cast<char>((0xff00000000000000 & Value) >> 56llu)
  > str_impl_;

 public:
{'fraction_non_alphanumeric': 0.1561311542810155, 'fraction_numerical': 0.022510021584952206, 'mean_word_length': 4.288043478260869, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 0, '>': 199, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, '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': '6186617', 'n_tokens_mistral': 3343, 'n_tokens_neox': 3080, 'n_words': 790}