title: Is it correct to declare a dynamic array of atomic using double pointers in C++?
body: <p>I need to create an array of atomic integers i.e. n integers each of which are atomic. I found that <code>std::vector&lt;std::atomic&lt;int&gt;&gt;</code> will not work but then I tried the following approach and it compiles successfully with clang.</p>
  
  <pre><code>int n;
  std::cin &gt;&gt; n;
  std::atomic&lt;int&gt; **a;
  a = new std::atomic&lt;int&gt;* [n];
  for(int i = 0; i &lt; n; i++)
  {
      a[i] = new std::atomic&lt;int&gt;();
  }
  </code></pre>
  
  <p>I'm not sure if doing this is correct, is it? Also, is there any method to verify if all the <code>a[i][0]</code> will be atomic here(except for checking it with multiple threads)?</p>