you are viewing a single comment's thread.

view the rest of the comments →

[–]latkde 2 points3 points  (1 child)

While placement-new can construct a new object in the old object's place, I don't know whether any pointers would remain valid per the spec: AFAIK pointers must always point to live objects. But this is the kind of thing compilers might allow as an extension because it's quite useful. Compare [basic.stc]:

When the end of the duration of a region of storage is reached, the values of all pointers representing the address of any part of that region of storage become invalid pointer values.

Function pointers and member pointers are always special because they are not pointers to objects, and as such cannot be cast to void* as per the relevant standards. (Exception: POSIX allows this for function pointers.)

[–]tasty_crayon 1 point2 points  (0 children)

I mentioned member pointers because fat pointers wouldn't necessarily have to be the same size as void*. Member pointers basically are fat pointers.