Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2003-10-11 15:18:33


"E. Gladyshev" <egladysh_at_[hidden]> wrote in message
news:20031011182129.34063.qmail_at_web40807.mail.yahoo.com...
>
> I did it almost the same as in the following example in the
> standard.

This example is in the standard? Unbelievable.

> [Example:
> struct B {
> virtual void f();
> void mutate();
> virtual ~B();
> };
> struct D1 : B { void f(); };
> struct D2 : B { void f(); };
> void B::mutate() {
> new (this) D2; // reuses storage -- ends the lifetime of *this
> [...]

You mean to tell me that this exact example is in the
standard? Where? First, where does ~B() get called?
Second, how can you be sure in general that *this is the right
size to hold a D2?

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk