One reader / one writer no-memory-allocation lock-free ring-buffer I have two threads - one thread queues items another thread dequeues. dequeue is fast enough and so we can assume that queue is never contains more than 65536 items.

C++ doesn't contain "ring-buffer."  Boost has one, but it doesn't allow "reuse" of elements. So I wrote my own ring-buffer, which I think is very fast and requires no memory allocation.  The code below has not been tested but it should show the general idea.

Do you find my code fine? Can you suggest how I can improve it or if there's something I can use instead of it?
    #include 
    #include 
    #include 

#include &lt;chrono&gt;
#include &lt;thread&gt;

template&lt;class T&gt; class ArrayPool
{
public:
    ArrayPool() {
    };

    ~ArrayPool(void) {
    };

    // reader thread
    bool IsEmpty() {
        return curReadNum == curWriteNum;
    }

    // reader thread
    T* TryGet()
    {
        if (curReadNum == curWriteNum)
        {
            return NULL;
        }
        T* result = &amp;storage[curReadNum &amp; MASK];
        ++curReadNum;
        return result;
    }

    // writer thread
    T* Obtain() {
        return &amp;storage[curWriteNum &amp; MASK];
    }

    // writer thread
    void Commit()
    {
                    // Ensure storage is written before mask is incremented ?
                    // insert memory barrier ?
        ++curWriteNum;
        if (curWriteNum - curReadNum &gt; length)
        {
            std::cout &lt;&lt;
                "ArrayPool curWriteNum - curReadNum &gt; length! " &lt;&lt;
                curWriteNum &lt;&lt; " - " &lt;&lt; curReadNum &lt;&lt; " &gt; " &lt;&lt; length &lt;&lt; std::endl;
        }
    }

    // writer thread
    void ObtainAndCommit(T* val) {
        memcpy(&amp;storage[curWriteNum &amp; MASK], val, sizeof(T));
        // copy constructor will likely be slower cause every field is copied
        // storage[curWriteNum &amp; MASK] = *val;
        Commit();
    }

private:
    static const uint32_t length = 65536;
    static const uint32_t MASK = length - 1;
    T storage[length];

    // curWriteNum must be volatile because access from both
    // reader and writer threads
    // curReadNum don't need to be volatile because accessed
    // only from one (reader) thread
    volatile uint32_t curWriteNum;
    uint32_t curReadNum;
};

struct myStruct {
    int value;
};

ArrayPool&lt;myStruct&gt; pool;

void ReadThread() {
    myStruct* entry;
    while(true) {
        while ((entry = pool.TryGet()) != NULL) {
            std::cout &lt;&lt; entry-&gt;value &lt;&lt; std::endl;
        }
    }
}

void WriteThread(int id) {
    std::chrono::milliseconds dura(1000 * id);
    std::this_thread::sleep_for(dura);

    myStruct* storage = pool.Obtain();
    storage-&gt;value = id;
    pool.Commit();
    std::cout &lt;&lt; "Commited value! " &lt;&lt; id &lt;&lt; std::endl;
}


int main( void )
{
    boost::thread readThread = boost::thread(&amp;ReadThread);
    boost::thread writeThread;
    for (int i = 0; i &lt; 100; i++) {
        writeThread = boost::thread(&amp;WriteThread, i);
    }
    writeThread.join();
    return 0;
}
there is absolutely no thread safety constructs, this means that you'll see a lot of interesting race conditions and memory inconsistencies 
just assuming dequeues happen fast enough does not mean they will in production
you return T by value in Obtain(), instead of by reference so you can't actually write into it
Obtain is a bad name, it sounds like it gets the next value like TryGet does
memcpy is a bad idea to use to store the values if there is ever a custom copy constructor and a destructor
that said Obtain->store->Commit can be put into a single Put(T*) member function
eventually curReadNum and curWriteNum will overflow, it's not a real problem here because your length is a power of 2 and they are unsigned