<commit_before>#ifndef IV_LV5_RADIO_ARENA_H_
#define IV_LV5_RADIO_ARENA_H_
#include <cstdio>
#include <cstdlib>
#include <iterator>
#include "detail/cstdint.h"
#include "detail/type_traits.h"
#include "utils.h"
#include "noncopyable.h"
#include "os_allocator.h"
#include "static_assert.h"
#include "lv5/radio/block.h"
namespace iv {
namespace lv5 {
namespace radio {

static const std::size_t kBlockSize = core::Size::KB * 4;
static const std::size_t kBlocks = 64;
static const std::size_t kArenaSize =
    IV_ALIGNED_SIZE(kBlockSize * kBlocks, kBlockSize);

// radio::Arena has 64 Blocks
class Arena : private core::Noncopyable<Arena> {
 public:
  typedef Arena this_type;
  typedef std::size_t size_type;


  // iterator
  // http://episteme.wankuma.com/stlprog/_02.html
  template<typename T>
  class iterator_base
    : public std::iterator<std::random_access_iterator_tag, T> {
   public:
    typedef iterator_base<T> this_type;
    typedef std::iterator<std::random_access_iterator_tag, T> super_type;
    typedef typename super_type::pointer pointer;
    typedef const typename super_type::pointer const_pointer;
    typedef typename super_type::reference reference;
    typedef const typename super_type::reference const_reference;
    typedef typename super_type::difference_type difference_type;
    typedef iterator_base<typename std::remove_const<T>::type> iterator;
    typedef iterator_base<typename std::add_const<T>::type> const_iterator;

    iterator_base() : ptr_(NULL) { }

    iterator_base(pointer ptr) : ptr_(ptr) { }  // NOLINT

    iterator_base(const iterator& it) : ptr_(it.ptr()) { }  // NOLINT

    reference operator*() const {
      return *ptr_;
    }
    reference operator[](difference_type d) const {
      return *reinterpret_cast<pointer>(
          reinterpret_cast<uintptr_t>(ptr_) + d * kBlockSize);
    }
    pointer operator->() const {<commit_msg>add comment to stack overflow<commit_after>#ifndef IV_LV5_RADIO_ARENA_H_
#define IV_LV5_RADIO_ARENA_H_
#include <cstdio>
#include <cstdlib>
#include <iterator>
#include "detail/cstdint.h"
#include "detail/type_traits.h"
#include "utils.h"
#include "noncopyable.h"
#include "os_allocator.h"
#include "static_assert.h"
#include "lv5/radio/block.h"
namespace iv {
namespace lv5 {
namespace radio {

static const std::size_t kBlockSize = core::Size::KB * 4;
static const std::size_t kBlocks = 64;
static const std::size_t kArenaSize =
    IV_ALIGNED_SIZE(kBlockSize * kBlocks, kBlockSize);

// radio::Arena has 64 Blocks
class Arena : private core::Noncopyable<Arena> {
 public:
  typedef Arena this_type;
  typedef std::size_t size_type;


  // iterator
  // see http://stackoverflow.com/questions/2150192/how-to-avoid-code-duplication-implementing-const-and-non-const-iterators
  template<typename T>
  class iterator_base
    : public std::iterator<std::random_access_iterator_tag, T> {
   public:
    typedef iterator_base<T> this_type;
    typedef std::iterator<std::random_access_iterator_tag, T> super_type;
    typedef typename super_type::pointer pointer;
    typedef const typename super_type::pointer const_pointer;
    typedef typename super_type::reference reference;
    typedef const typename super_type::reference const_reference;
    typedef typename super_type::difference_type difference_type;
    typedef iterator_base<typename std::remove_const<T>::type> iterator;
    typedef iterator_base<typename std::add_const<T>::type> const_iterator;

    iterator_base() : ptr_(NULL) { }

    iterator_base(pointer ptr) : ptr_(ptr) { }  // NOLINT

    iterator_base(const iterator& it) : ptr_(it.ptr()) { }  // NOLINT

    reference operator*() const {
      return *ptr_;
    }
    reference operator[](difference_type d) const {
      return *reinterpret_cast<pointer>(
          reinterpret_cast<uintptr_t>(ptr_) + d * kBlockSize);
    }
    pointer operator->() const {
{'fraction_non_alphanumeric': 0.11185740118832344, 'fraction_numerical': 0.006974941875484371, 'mean_word_length': 4.840120663650075, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, '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': '3355680', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1232, 'n_words': 281}