#include <iostream>
#include <vector>
class IntVect {
public:
static const int size0 = 16;
int ar0[size0];
int* arr[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
int size = 0;
int reserve = 10;
int& operator[](int index)
{
if (index < size0)
return ar0[index];
else
{
index >>= 4;
int count = -1;
int chunksize = 8;
while (index > 0)
{
index >>= 1;
count++;
chunksize *= 2;
}
if (arr[count] == NULL)
{
arr[count] = new int[chunksize];
return ar0[0];//todo
}
else
return ar0[0];//todo
}
}
//push_back(int)
};
int main() {
IntVect iv;
iv[10] = 10;
iv[20] = 20;
iv[21] = 20;
iv[35] = 20;
iv[36] = 20;
//std::vector<int> v{ 1, 2, 3, 4, 5 };
////v.capacity()
////v.push_back()
//int first = v.front(); // 1
//int last = v.back(); // 5
//int second = v[1]; // 2
//std::cout << "first: " << first << std::endl;
//std::cout << "second: " << second << std::endl;
//std::cout << "last: " << last << std::endl;
//v[0] = 6; // изменяем значение
//for (int n : v)
// std::cout << n << "\t"; // 6 2 3 4 5
//std::cout << std::endl;
}