Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2007-05-25 23:21:57


On 5/23/07, Peter Dimov <pdimov_at_[hidden]> wrote:

> [snip]

>
> struct Base
> {
> virtual ~Base() {}
> };
>
> struct Derived: Base
> {
> int i;
> };
>
> Derived * pd = new Derived;
> Base * pb = pd;
> shared_ptr<void> pv( pb );

> [snip]

>
> or
>
> pv->pointer() == pd && pv->type() == typeid(Derived);

Sorry if it is too obvious. But how can shared_ptr implement
pv->pointer() == pd ?
It takes pb from the constructor, it doesnt know anything about Derived.

> [snip]

Thanks,

-- 
Felipe Magno de Almeida

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