//FTTArray - [2020-04-13 11:57:47]
#ifndef _FTTARRAY_H_
#define _FTTARRAY_H_

#include <stdio.h>
#include <stdlib.h>

/*
00189DB4 FTTArray<FTTPair<float,float>,16u>::Insert(FTTPair<float,float>&&)
0018A31A FTTArray<FTTPair<float,float>,16u>::Iterator::operator++()
0018A322 FTTArray<FTTPair<float,float>,16u>::Iterator::operator!=(FTTArray<FTTPair<float,float>,16u>::Iterator const&)
0018A32E FTTArray<FTTPair<float,float>,16u>::Iterator::operator*()
0018A332 FTTArray<FTTPair<float,float>,16u>::Iterator::operator->()
0018A338 FTTArray<FTTPair<float,float>,16u>::Iterator::operator+=(long const&)
0018A358 FTTArray<FTTPair<float,float>,16u>::Iterator::operator-=(long const&)
0018A378 FTTArray<FTTPair<float,float>,16u>::Iterator::operator[](long const&)
0018A384 FTTArray<FTTPair<float,float>,16u>::Iterator::operator+(long const&)
0018A3A0 FTTArray<FTTPair<float,float>,16u>::Iterator::operator-(long const&)
0018A3BC FTTArray<FTTPair<float,float>,16u>::Iterator::operator-(FTTArray<FTTPair<float,float>,16u>::Iterator const&)

TShadowAABB 0x124 296
001C3788 FTTArray<TShadowAABB,  92u>::FTTArray(uint) 第二个参数是数量
001C37AE FTTArray<TShadowAABB,  256u>::FTTArray(uint)
001C6982 FTTArray<TShadowAABB *,256u>::Iterator::operator++()
001C698A FTTArray<TShadowAABB *,256u>::Iterator::operator!=(FTTArray<TShadowAABB *,256u>::Iterator const&)
001C6996 FTTArray<TShadowAABB *,256u>::Iterator::operator*()
001C699A FTTArray<TShadowAABB *,256u>::Iterator::operator->()
001C69A0 FTTArray<TShadowAABB *,256u>::Iterator::operator+=(long const&)
001C69C0 FTTArray<TShadowAABB *,256u>::Iterator::operator-=(long const&)
001C69E0 FTTArray<TShadowAABB *,256u>::Iterator::operator[](long const&)
001C69EC FTTArray<TShadowAABB *,256u>::Iterator::operator+(long const&)
001C6A08 FTTArray<TShadowAABB *,256u>::Iterator::operator-(long const&)
001C6A24 FTTArray<TShadowAABB *,256u>::Iterator::operator-(FTTArray<TShadowAABB *,256u>::Iterator const&)
*/

struct TypeData {
  int len;
  void *data;
};

template <class T, int N>
class FTTArray {
public:
  FTTArray(int a2) {
    m_count = a2;
  };

  //Iterator<T> *CreateIterator() {
  // return new Iterator<T>(&array_0[0]);
  //}

  T *Insert(T &a2) {
    int v2;     //r2
    float v3;   //r12
    T *result;  //r0
    float v5;   //r2

    v2 = m_count;
    m_count = v2 + 1;
    v3 = array_0[v2].field_0;
    array_0[v2].field_0 = a2->field_0;
    result = &array_0[v2];
    a2->field_0 = v3;
    v5 = result->field_4;
    result->field_4 = a2->field_4;
    a2->field_4 = v5;
    return result;
  }

  class Iterator {
  public:
    Iterator(T *p_data) : m_buf(p_data) {
    }

    bool operator!=(Iterator const &a1) {
      return m_buf != a1.m_buf;
    }

    //0018A32E
    T *operator*() {
      return m_buf;
    }

    //0018A384
    //FTTArray<FTTPair<float,float>,16u>::Iterator::operator+(long const&)
    TypeData operator+(int *a3) {
      T *v3 = m_buf + *a3;
      TypeData result;
      result.len = sizeof(T);
      result.data = (void *)v3;
      return result;
    }

  //0018A31A
    T *operator++() {
      m_buf++;
      return m_buf;
    }

    //0018A338
    TypeData operator+=(int *a3) {
      m_buf += *a3;
      TypeData result;
      result.len = sizeof(T);
      result.data = (void *)m_buf;
      return result;
    }

    //0018A3BC
    int operator-(Iterator const &a2) {
      return m_buf - a2.m_buf;
    }

    //0018A3A0
    TypeData operator-(int *a3) {
      T *v3 = m_buf - *a3;

      TypeData result;
      result.len = sizeof(T);
      result.data = (void *)v3;
      return result;
    }

    //0018A358
    TypeData operator-=(int *a3) {
      m_buf += *a3;

      TypeData result;
      result.len = sizeof(T);
      result.data = (void *)m_buf;
      return result;
    }

    //0018A332
    T *operator->() {
      return m_buf;
    }

    //0018A378
    T *operator[](int *a2) {
      return m_buf + *a2;
    }

  private:
    int m_unuse;
    T *m_buf;
  };

  T array_0[N];
  int m_count;
};

/*
bool __fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator!=(int a1, int a2) {
  return *(_DWORD *)(a1 + 4) != *(_DWORD *)(a2 + 4);
}

int __fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator*(int a1) {
  return *(_DWORD *)(a1 + 4);
}

0018A384
_DWORD *__fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator+(_DWORD *result, int a2, _DWORD *a3) {
  int v3; //r1

  v3 = *(_DWORD *)(a2 + 4) + 8 * *a3;
  *result = &off_3231A0;
  result[1] = v3;
  return result;
}

int __fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator++(int result) {
  *(_DWORD *)(result + 4) += 8;
  return result;
}

_QWORD *__fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator+=(_QWORD *result, int a2, _DWORD *a3) {
  __int64 v3; //r1

  HIDWORD(v3) = *(_DWORD *)(a2 + 4) + 8 * *a3;
  *(_DWORD *)(a2 + 4) = HIDWORD(v3);
  LODWORD(v3) = &off_3231A0;
  *result = v3;
  return result;
}

int __fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator-(int a1, int a2) {
  return (*(_DWORD *)(a1 + 4) - *(_DWORD *)(a2 + 4)) >> 3;
}

_DWORD *__fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator-(_DWORD *result, int a2, _DWORD *a3) {
  int v3; //r1

  v3 = *(_DWORD *)(a2 + 4) - 8 * *a3;
  *result = &off_3231A0;
  result[1] = v3;
  return result;
}

_QWORD *__fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator-=(_QWORD *result, int a2, _DWORD *a3) {
  __int64 v3; //r1

  HIDWORD(v3) = *(_DWORD *)(a2 + 4) - 8 * *a3;
  *(_DWORD *)(a2 + 4) = HIDWORD(v3);
  LODWORD(v3) = &off_3231A0;
  *result = v3;
  return result;
}

int __fastcall FTTArray<FTTPair<float,float>,16u>::Iterator::operator->(int a1) {
  return *(_DWORD *)(a1 + 4);
}

*/
#endif  //_FTTARRAY_H_