[Ns-developers] A question about downcast netdevice pointer.

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Thu Sep 25 09:21:37 PDT 2008


On Thu, 2008-09-25 at 17:16 +0100, Gustavo Carneiro wrote:

> 
> Although dynamic_cast<CsmaNetDevice*> (PeekPointer (dev)) is a bit
> more verbose.  Ideally I think it would make a lot of sense to have a
> smart-pointer based dynamic cast variant, something like:
> 
> static inline Ptr<T2> DynamicCast<T2> (Ptr<T1> ptr)
> {
>    return Ptr<T2> (dynamic_cast<T2*> (PeekPointer (ptr)));
> }
> 
> Unfortunately the idea got no traction, at the time.

I (maintainer hat on) would be fine with a patch to define a dynamic
cast template function in src/core/ptr.h

Mathieu



More information about the Ns-developers mailing list