<commit_before>#ifndef ETL_COMMON_TYPE_TRAITS_H_
#define ETL_COMMON_TYPE_TRAITS_H_

#include "etl/common/attribute_macros.h"

namespace etl {
namespace common {

/*
 * RemoveReference<T>::type strips any reference type from T.
 */

template <typename T>
struct RemoveReference {
  typedef T type;
};

template <typename T>
struct RemoveReference<T &> {
  typedef T type;
};

template <typename T>
struct RemoveReference<T &&> {
  typedef T type;
};


/*
 * Promoting values to types.
 */

template <typename T, T V>
struct IntegralConstant {
  static constexpr T value = V;
  typedef T value_type;
  typedef IntegralConstant<T, V> type;
  constexpr operator T() { return V; }
};

typedef IntegralConstant<bool, true>  TrueType;
typedef IntegralConstant<bool, false> FalseType;

/*
 * Reasoning about type relationships.
 */

template <typename T, typename S>
struct IsSame : public FalseType {};

template <typename T>
struct IsSame<T, T> : public TrueType {};

}  // namespace common
}  // namespace etl

#endif  // ETL_COMMON_TYPE_TRAITS_H_<commit_msg>wip type_traits<commit_after>#ifndef ETL_COMMON_TYPE_TRAITS_H_
#define ETL_COMMON_TYPE_TRAITS_H_

#include "etl/common/attribute_macros.h"

namespace etl {
namespace common {

/*
 * RemoveReference<T>::type strips any reference type from T.
 */

template <typename T>
struct RemoveReference {
  typedef T type;
};

template <typename T>
struct RemoveReference<T &> {
  typedef T type;
};

template <typename T>
struct RemoveReference<T &&> {
  typedef T type;
};

/*
 * RemoveVolatile and RemoveConst strip qualifiers from a type.
 */
template <typename T>
struct RemoveVolatile {
  typedef T type;
};

template <typename T>
struct RemoveVolatile<T volatile> {
  typedef T type;
};

template <typename T>
struct RemoveConst {
  typedef T type;
};

template <typename T>
struct RemoveConst<T const> {
  typedef T type;
};

template <typename T>
struct RemoveConstVolatile {
 private:
  typedef typename RemoveConst<T>::type no_const;
 public:
  typedef typename RemoveVolatile<no_const>::type type;
};


/*
 * Promoting values to types.
 */

template <typename T, T V>
struct IntegralConstant {
  static constexpr T value = V;
  typedef T value_type;
  typedef IntegralConstant<T, V> type;
  constexpr operator T() { return V; }
};

template <bool V>
struct BoolConstant : public IntegralConstant<bool, V> {};

typedef BoolConstant<true>  TrueType;
typedef BoolConstant<false> FalseType;

/*
 * Fundamental types.
 */

#define ETL_COMMON_SPECIALIZE(tmpl, type, value) \
  template <> \
  struct tmpl<type> : public BoolConstant<value> {}

template <typename T>
struct IsUnqualifiedIntegral : public FalseType {};

ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, bool, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, char, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, signed char, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, unsigned char, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, short, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, unsigned short, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, int, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, unsigned int, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, long, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, unsigned long, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, long long, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedIntegral, unsigned long long, true);

template <typename T>
struct IsIntegral
  : public IsUnqualifiedIntegral<typename RemoveConstVolatile<T>::type> {};

template <typename T>
struct IsUnqualifiedFloatingPoint : public FalseType {};

ETL_COMMON_SPECIALIZE(IsUnqualifiedFloatingPoint, float, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedFloatingPoint, double, true);
ETL_COMMON_SPECIALIZE(IsUnqualifiedFloatingPoint, long double, true);

template <typename T>
struct IsFloatingPoint
  : public IsUnqualifiedFloatingPoint<typename RemoveConstVolatile<T>::type> {};

template <typename T>
struct IsArithmetic
  : public BoolConstant<IsIntegral<T>::value || IsFloatingPoint<T>::value> {};

template <typename T>
struct IsSigned
  : public BoolConstant<IsFloatingPoint<T>::value
                        || (IsIntegral<T>::value && (T(-1) < T(0)))> {};
template <typename T>
struct IsUnsigned
  : public BoolConstant<IsArithmetic<T>::value && !IsSigned<T>::value> {};


/*
 * Reasoning about type relationships.
 */

template <typename T, typename S>
struct IsSame : public FalseType {};

template <typename T>
struct IsSame<T, T> : public TrueType {};

}  // namespace common
}  // namespace etl

#endif  // ETL_COMMON_TYPE_TRAITS_H_
{'fraction_non_alphanumeric': 0.10403120936280884, 'fraction_numerical': 0.00043346337234503684, 'mean_word_length': 5.630747126436781, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 63, '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': '768137', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1484, 'n_words': 392}