C++ std::atomic and shared memory?
<p>I have 4096 bytes of shared memory allocated. How to treat it as an array of <code>std::atomic&lt;uint64_t&gt;</code> objects?</p>

<p>The final goal is to place array of 64-bit variables to shared memory and perform <code>__sync_fetch_and_add</code> (GCC built-in) on these variables. But I would prefer using native C++11 code instead of using GCC built-ins. So how to use the allocated memory as an std::atomic objects? Should I invoke <code>placement new</code> on 512 counters? What If <code>std::atomic</code>'s constructor require additional memory allocations in some imeplementations? Should I consider the aligning of <code>std::atomic</code> object in shared memory?</p>