<commit_before>// dynamic_array.h
#ifndef INCLUDED_DYNAMICARRAY
#define INCLUDED_DYNAMICARRAY

#include <counting_allocator.h>
#include <stdexcept>

namespace StevensDev
{

namespace sgdc
{
template <class T>
class DynamicArray
{
  private:
    unsigned int d_length;
    unsigned int d_maxSize;
    sgdm::IAllocator<T>* d_alloc;
    T *d_data;
  public:
    // CONSTRUCTORS
    DynamicArray();
    DynamicArray( const int size );
    DynamicArray( const DynamicArray &a );
    DynamicArray &operator=( const DynamicArray &a );
    DynamicArray( sgdm::IAllocator<T>* alloc );

    // DESTRUCTORS
    ~DynamicArray();

    // MEMBER FUNCTIONS
    void push( const T& element );
    void pushFront( T element );
    T pop();
    T popFront();
    unsigned int const getLength();
    unsigned int const getMaxSize();
    const T at( unsigned int index );
    T operator []( int i );
    T removeAt( unsigned int index );
    T insertAt( unsigned int index );
};

// CONSTRUCTORS
template <class T>
inline
DynamicArray<T>::DynamicArray() : d_length( 0 ),
    d_alloc( new sgdm::CountingAllocator<T> ),
    d_data( d_alloc->get( 16 ) ),
    d_maxSize( 16 )
{
} // Default Constructor

template <class T>
inline
DynamicArray<T>::DynamicArray( const int size ) :
    d_length( 0 ),
    d_alloc( new sgdm::CountingAllocator<T> ),
    d_data( d_alloc->get(size) ),
    d_maxSize( size )
{
} // Initial Size Constructor

template <class T>
inline
DynamicArray<T>::DynamicArray( sgdm::IAllocator<T>* alloc )
{
  d_alloc = alloc;
} // Initial allocator Constructor

// MEMBER FUNCTIONS
template <class T>
inline
unsigned int const DynamicArray<T>::getLength()
{
    return d_length;
}

template <class T>
inline
unsigned int const DynamicArray<T>::getMaxSize()
{
    return d_maxSize;
}

template <class T><commit_msg>Add CountingAllocator's destructor<commit_after>// dynamic_array.h
#ifndef INCLUDED_DYNAMICARRAY
#define INCLUDED_DYNAMICARRAY

#include <counting_allocator.h>
#include <stdexcept>

namespace StevensDev
{

namespace sgdc
{
template <class T>
class DynamicArray
{
  private:
    unsigned int d_length;
    unsigned int d_maxSize;
    sgdm::IAllocator<T>* d_alloc;
    T *d_data;
  public:
    // CONSTRUCTORS
    DynamicArray();
    DynamicArray( const int size );
    DynamicArray( const DynamicArray &a );
    DynamicArray &operator=( const DynamicArray &a );
    DynamicArray( sgdm::IAllocator<T>* alloc );

    // DESTRUCTORS
    ~DynamicArray();

    // MEMBER FUNCTIONS
    void push( const T& element );
    void pushFront( T element );
    T pop();
    T popFront();
    unsigned int const getLength();
    unsigned int const getMaxSize();
    const T at( unsigned int index );
    T operator []( int i );
    T removeAt( unsigned int index );
    T insertAt( unsigned int index );
};

// CONSTRUCTORS
template <class T>
inline
DynamicArray<T>::DynamicArray() : d_length( 0 ),
    d_alloc( new sgdm::CountingAllocator<T> ),
    d_data( d_alloc->get( 16 ) ),
    d_maxSize( 16 )
{
} // Default Constructor

template <class T>
inline
DynamicArray<T>::DynamicArray( const int size ) :
    d_length( 0 ),
    d_alloc( new sgdm::CountingAllocator<T> ),
    d_data( d_alloc->get(size) ),
    d_maxSize( size )
{
} // Initial Size Constructor

template <class T>
inline
DynamicArray<T>::DynamicArray( sgdm::IAllocator<T>* alloc )
{
  d_alloc = alloc;
} // Initial allocator Constructor

// DESTRUCTOR
template <class T>
inline
DynamicArray<T>::~DynamicArray<T>()
{
    delete[] d_data;
}

// MEMBER FUNCTIONS
template <class T>
inline
unsigned int const DynamicArray<T>::getLength()
{
    return d_length;
}

template <class T>
inline
unsigned int const DynamicArray<T>::getMaxSize()
{
    return d_maxSize;
}

template <class T>
{'fraction_non_alphanumeric': 0.11860776439089692, 'fraction_numerical': 0.00321285140562249, 'mean_word_length': 3.7592356687898087, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 48, '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': '3383442', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1228, 'n_words': 347}