Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: last CS wordsmithing: we only guarantee this works on Clang & GCC

...

The amount of overhead required by array new expressions is unspecified but should ideally would be documented by quality implementations. The following compliant solution is portable to specifically for the Clang and GNU GCC compilers. Porting it , which guarantee that twice the space to hold array elements is sufficient to hold the entire array, including overhead. Porting this compliant solution to other implementations requires adding similar conditional definitions of the overhead constant. When an implementation does not document the overhead, assuming it is at least as large as twice the size of sizeof(size_t) should typically be safe. To  To verify that the assumption is, in fact, safe, the compliant solution defines an overload of also overloads the placement new[] operator that accepts to accept the buffer size as a third argument and verifies that it is at least as large as the total amount of storage required.

...