title: C++ aligned new[]
body: <h3>Overview</h3>
  <p>When browsing <a href="https://en.cppreference.com/w/cpp/memory/new/operator_new" rel="noreferrer">operator new, operator new[] - cppreference.com</a>, it seems we have a number of options for allocating arrays of objects with specific alignment requirements. However, it is not specified how to use them, and I can't seem to find the correct C++ syntax.</p>
  <p>Can I somehow make an explicit call to this operator, or will the compiler automatically infer the overload? :</p>
  <pre class="lang-cpp prettyprint-override"><code>void* operator new[]( std::size_t count, std::align_val_t al );
  </code></pre>
  <p>Looking at <a href="https://www.bfilipek.com/2019/08/newnew-align.html" rel="noreferrer">Bartek's coding blog</a>, it seems like the compiler will automatically choose an overload based on whether or not the alignment requirement is larger than <code>__STDCPP_DEFAULT_NEW_ALIGNMENT__</code> (which is usually 16 on 64-bit machines).</p>
  <h3>Question</h3>
  <p>Is it possible to manually choose an overload for the <code>new</code> operator in some cases? Sometimes I might want an allocated block to be aligned in a certain way (I assume the alignment to always be a power of 2, and likely larger than 16).</p>
  <h3>Choice of compiler</h3>
  <p>I'm probably going to be using GCC and C++ &gt;= 17 for the foreseeable future.</p>