<commit_before>
#pragma once

#include "stdafx.h"
#include <string.h>

//A dummy allocator to make contiguouslist's template signature
//the same as vector and list
template <class T>
class __listdummyallocator {};

//A contiguous list is an implementation which 
//supports pushing members at the end
//and removing members from any point
//It will automatically do both of these things fairly quickly
//it is designed to contain pointers, not data
//Note: order of contents /not/ maintained!
//		and allocator does not actually do anything
template <class T, class _Alloc = __listdummyallocator<T>>
class ContiguousList{
	//The array of stored data
	T * data;
	//The current listCapacity
	unsigned int listCapacity;
	//The current listSize
	unsigned int listSize;
	//Whether or not to autoreduce the capacity based off the size
	//enabled by default
	bool autoreduceCapacity;

	//Resize data to the new listCapacity
	void resize(int newCapacity) {
		//Allocate the new storage
		T * newData = new T[newCapacity];
		//Copy over the data
		memcpy(newData,data,sizeof(T)*listCapacity);
		//Clean up the old storage
		delete [] data;
		//Remember only the new storage
		data = newData;
		listCapacity = newCapacity;
	}
public:
	ContiguousList() {
		autoreduceCapacity = true;
		listCapacity = 10;<commit_msg>Patched a bug in ContiguousList which was causing memory corruption during size reductions<commit_after>
#pragma once

#include "stdafx.h"
#include <string.h>

//A dummy allocator to make contiguouslist's template signature
//the same as vector and list
template <class T>
class __listdummyallocator {};

//A contiguous list is an implementation which 
//supports pushing members at the end
//and removing members from any point
//It will automatically do both of these things fairly quickly
//it is designed to contain pointers, not data
//Note: order of contents /not/ maintained!
//		and allocator does not actually do anything
template <class T, class _Alloc = __listdummyallocator<T>>
class ContiguousList{
	//The array of stored data
	T * data;
	//The current listCapacity
	unsigned int listCapacity;
	//The current listSize
	unsigned int listSize;
	//Whether or not to autoreduce the capacity based off the size
	//enabled by default
	bool autoreduceCapacity;

	//Resize data to the new listCapacity
	void resize(int newCapacity) {
		//Allocate the new storage
		T * newData = new T[newCapacity];
		//Copy over the data
		memcpy(newData,data,sizeof(T)*listSize);
		//Clean up the old storage
		delete [] data;
		//Remember only the new storage
		data = newData;
		listCapacity = newCapacity;
	}
public:
	ContiguousList() {
		autoreduceCapacity = true;
		listCapacity = 10;
{'fraction_non_alphanumeric': 0.0782122905027933, 'fraction_numerical': 0.0014897579143389199, 'mean_word_length': 4.058380414312618, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4096950', 'n_tokens_mistral': 810, 'n_tokens_neox': 759, 'n_words': 337}