<commit_before>#pragma once
#include <assert.h>

namespace other {

template<class Iter> struct Range {
  typedef decltype(*boost::declval<Iter>()) Reference;

  const Iter lo, hi;

  Range(const Iter& lo, const Iter& hi)
    :lo(lo),hi(hi) {}

  const Iter& begin() const { return lo; }
  const Iter& end() const { return hi; }

  Iter operator[](const int i) const { assert(0<=i && i<hi-lo); return lo+i; }
  
  Reference front() const { assert(lo!=hi); return *lo; }
  Reference back() const { assert(lo!=hi); return *(hi-1); }
};

template<> struct Range<int> {
  int lo, hi;
  
  struct Iter {
    int i;
    explicit Iter(int i) : i(i) {}
    bool operator!=(Iter j) const { return i != j.i; }
    void operator++() { ++i; }
    void operator--() { --i; }
    int operator*() const { return i; }
  };

  Range()
    : lo(0), hi(0) {}

  Range(int lo, int hi)
    : lo(lo), hi(hi) {
    assert(lo<=hi);<commit_msg>added missing header<commit_after>#pragma once
#include <assert.h>
#include <boost/utility/declval.hpp>

namespace other {

template<class Iter> struct Range {
  typedef decltype(*boost::declval<Iter>()) Reference;

  const Iter lo, hi;

  Range(const Iter& lo, const Iter& hi)
    :lo(lo),hi(hi) {}

  const Iter& begin() const { return lo; }
  const Iter& end() const { return hi; }

  Iter operator[](const int i) const { assert(0<=i && i<hi-lo); return lo+i; }

  Reference front() const { assert(lo!=hi); return *lo; }
  Reference back() const { assert(lo!=hi); return *(hi-1); }
};

template<> struct Range<int> {
  int lo, hi;

  struct Iter {
    int i;
    explicit Iter(int i) : i(i) {}
    bool operator!=(Iter j) const { return i != j.i; }
    void operator++() { ++i; }
    void operator--() { --i; }
    int operator*() const { return i; }
  };

  Range()
    : lo(0), hi(0) {}

  Range(int lo, int hi)
    : lo(lo), hi(hi) {
    assert(lo<=hi);
{'fraction_non_alphanumeric': 0.18423855165069222, 'fraction_numerical': 0.004259850905218318, 'mean_word_length': 3.231981981981982, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 14, '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': '5582990', 'n_tokens_mistral': 681, 'n_tokens_neox': 668, 'n_words': 201}