|
Boost : |
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2005-10-27 11:40:58
On 10/27/05, Martin Bonner <martin.bonner_at_[hidden]> wrote:
> Nit: Actually the static type is virtual_vector<person>*, and the dynamic
> type is people*. (The standard talks about the static and dynamic types of
> the operand to delete, not the static and dynamic types of the object
> pointed to by the operand to delete.)
>
I disagree, though admittedly I believe the standard is poor in its wording.
If the standard were refering to the static and dynamic type of the pointer,
as it does sound since it only states "operand", then the rest of the
statement would not make sense since a pointer type is never derived from
another pointer type and a pointer never has a virtual destructor. Not only
that, but the static and dynamic type of the pointer we are describing would
be the same anyway, not different (both its static and dynamic type are
virtual_vector<person>*, its target is what has a different static and
dynamic type).
The wording should probably be changed to say "object to be deleted" instead
of "operand", which is how the wording is for deleting a pointer to the
first element of a dynamically allocated array.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk