<commit_before>#ifndef __ANALLOC2_FIXED_REGION_LIST_HPP__
#define __ANALLOC2_FIXED_REGION_LIST_HPP__

#include "region-list.hpp"

namespace ANAlloc {

template <int capacity>
class FixedRegionList : public RegionList {
public:
  // overloaded methods
  virtual const Region & operator[](int idx) const {
    return regions[idx];
  }
  
  virtual int GetCount() const {
    return count;
  }
  
  // specific methods
  virtual Region & operator[](int idx) {
    return regions[idx];
  }
  
  virtual bool Push(const Region & reg) {
    if (count == capacity) return false;
    regions[count++] = reg;
    return true;
  }
  
private:
  Region regions[capacity];
  int count = 0;
};

}

#endif<commit_msg>insert region at any index<commit_after>#ifndef __ANALLOC2_FIXED_REGION_LIST_HPP__
#define __ANALLOC2_FIXED_REGION_LIST_HPP__

#include "region-list.hpp"

namespace ANAlloc {

template <int capacity>
class FixedRegionList : public RegionList {
public:
  // overloaded methods
  virtual const Region & operator[](int idx) const {
    return regions[idx];
  }
  
  virtual int GetCount() const {
    return count;
  }
  
  // specific methods
  virtual Region & operator[](int idx) {
    return regions[idx];
  }
  
  virtual bool Push(const Region & reg) {
    if (count == capacity) return false;
    regions[count++] = reg;
    return true;
  }
  
  virtual bool Insert(const Region & reg, int idx) {
    if (count == capacity) return false;
    for (int i = idx; i < count; ++i) {
      regions[i + 1] = regions[i];
    }
    regions[idx] = reg;
    ++count;
  }
  
private:
  Region regions[capacity];
  int count = 0;
};

}

#endif
{'fraction_non_alphanumeric': 0.10927960927960928, 'fraction_numerical': 0.004273504273504274, 'mean_word_length': 3.335978835978836, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '954568', 'n_tokens_mistral': 546, 'n_tokens_neox': 546, 'n_words': 150}