Pete Becker said:
18.4.1.3 (Placement forms of operator new and operator delete): "The
provisions of 3.7.3 do not apply to these reserved placement forms of
operator new and operator delete."
Grumble grumble. Darn it.
And that's the whole point of having them: the user is supplying the
memory, and presumably knows what's needed.
Okay I think I have a solution: char buffers and memcpy!
3.9/2 says:
For any complete POD object type T, whether or not the object holds a valid
value of type T, the underlying
bytes (1.7) making up the object can be copied into an array of char or
unsigned char.36) If the content
of the array of char or unsigned char is copied back into the object, the
object shall subsequently
hold its original value. [Example:
#define N sizeof(T)
char buf[N];
T obj; // obj initialized to its original value
memcpy(buf, &obj, N); // between these two calls to memcpy,
// obj might be modified
memcpy(&obj, buf, N); // at this point, each subobject of obj of scalar type
// holds its original value
-end example]
So:
This restricts the examples I have been working with to also be "POD" types,
and the storage to be a character buffer, but these restrictions I can live
with.
Thanks ever so much for all your help Pete! Let me know if you ever need a
favour.
- Christopher Diggins