#include <iostream>
#include <initializer_list>
#include <functional>
#define DEBUG
template<class T> class Array
{
public:
Array() = default;
Array(std::initializer_list<T> args)
{
int iter = 0;
this-> array = new T[args.size()];
this-> array_size = args.size();
for (T elem : args)
{
this-> array[iter] = elem;
iter++;
}
}
void map(std::function<void(T& elem)> action)
{
for (int i = 0; i < this-> array_size; i++)
{
action(this-> array[i]);
}
}
#ifdef DEBUG
void print()
{
for (int i = 0; i < this-> array_size; i++)
{
std::cout << this-> array[i] << ": " << i << "\n";
}
}
#endif
private:
T* array;
int array_size = 0;
};