#include <iostream>

struct MyArray
{
    using value_type = double;  // make value_type an alias for double.

    explicit MyArray(unsigned size=64) 
        : _storage(new value_type[size]), _capacity(size), _used(0) {}

    ~MyArray() { delete [] _storage; }

    unsigned capacity() const { return _capacity; }
    unsigned size() const { return _used; }

    void add_value(value_type value);

    friend std::ostream& operator <<(std::ostream& out, const MyArray& arr);

private:

    value_type* _storage;

    unsigned _capacity;
    unsigned _used;
};

void MyArray::add_value(MyArray::value_type value)
{
    if (size() == capacity())
    {
        // grow the array.
        throw;  // until functionality is implemented.
    }

    _storage[_used++] = value;
}

// display a MyArray:
std::ostream& operator <<(std::ostream& out, const MyArray& arr)
{
    out << "{ ";

    if (arr.size())
    {
        unsigned i = 0;
        while (i < arr.size() - 1)
            out << arr._storage[i++] << ", ";
        out << arr._storage[i] << ' ';
    }

    return out << '}' ;
}

int main()
{
    MyArray arr(3);
    std::cout << arr << "\n\n";

    arr.add_value(1.1);
    arr.add_value(2.2);
    arr.add_value(3.3);

    std::cout << arr << '\n';
}
