考虑以下 C++ 伪代码:
// Pointer to contiguous memory block suitably aligned to contain
// an array of type T. Possibly obtained via std::malloc or std::aligned_storage.
void *buffer = ...;
// Now cast as T pointer.
T *ptr = static_cast<T *>(buffer);
// Do some pointer arithmetics. For instance, construct the first two
// elements of the array.
::new (ptr) T();
::new (ptr + 1) T();
// etc.
这合法吗?标准对在强制转换后进行指针算术有何规定?C++11 标准的 5.7/5 讨论了指向数组对象元素的指针的算术运算,但是任何连续的内存块都可以被视为数组吗?