How do you enqueue and dequeue a circular array?
<p>Suppose you're implementing a generic circular array, such as:</p>

<pre><code>template &lt;class T&gt;
class circle
{
  private:
    T *items;
    int front;
    int back;
    int total_size;
    int capacity_limit;

  public:
    circle(int initial_capacity = 2);
    ~circle();
    void enqueue(T itemToEnqueue);
    int dequeue(T &amp;itemToDequeue);
};
</code></pre>

<p>What are the most simple implementations of methods enqueue and dequeue, given that if enqueueing will result in total_size > capacity_limit, a new array should be created with twice the capacity_limit?</p>

<p>I'm having trouble figuring out what to do with back and front given that  this is a circular array.  What happens as we enqueue or dequeue elements?  Any help would be appreciated.  Thanks.</p>
