left of [fill in the blank] must have class/struct/union error
<p>So I have this line:</p>

<pre><code>ArrayList&lt;Operation&gt; operations();
</code></pre>

<p>Now, this is my ArrayList class and my Operation struct:</p>

<pre><code>typedef struct Operation {
    char key; 
    int value;
} Operation;
template &lt;class DT&gt;
class ArrayList
{
private:
    int _capacity;
    int _size;
    DT* elements;
public:
    ArrayList();
    ~ArrayList();
    void insert (DT&amp;);
    DT&amp; operator[] (int);
};
ArrayList&lt;DT&gt;::ArrayList()
{
    _capacity = 10;
    _size = 0;
    elements = new DT[10];
}
</code></pre>

<p>I don't see the need of posting the code of the other methods since the error isn't happening there. However if you want to see them you just have to ask.</p>

<p>Now, everytime I try to do something like</p>

<pre><code>operations.insert(x) //assuming x is a struct that exists.
</code></pre>

<p>or</p>

<pre><code>operations[i].key; //assuming i is a declared and initialized index.
</code></pre>

<p>It gives me the <code>error C2228: left of (fill in the blank) must have class/struct/union</code>
and <code>error C2109: subscript requires array or pointer type</code></p>

<p>I have seen a previous thread about this problem and I think my problem is that the compiler takes the first line of code I provided as a declaration, but no initialization.
However I didn't see a solution for this. In my head the only solution is to make it a pointer and use <code>= new ...</code> but in my head the keyword <code>new</code> is synonym of nastiness so I simply wanted to make it a an object. What is a way to go around this?
Or perhaps I am wrong, and this has something to do with the object type being a <code>struct</code> since this is the first time I work with <code>struct</code>s.</p>
