Bug 382

Summary: feature request: templated DynamicCast
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: coreAssignee: Mathieu Lacage <mathieu.lacage>
Status: RESOLVED FIXED    
Severity: normal CC: gjcarneiro, ns-bugs
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Tom Henderson 2008-10-18 10:07:32 UTC
Quoting Gustavo from a post from about a month ago:

"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'd like to suggest we consider adding this.
Comment 1 Gustavo J. A. M. Carneiro 2008-10-18 17:08:35 UTC
+1 from me :)
Comment 2 Craig Dowell 2008-10-18 18:16:43 UTC
+1
Comment 3 Mathieu Lacage 2008-10-20 02:41:00 UTC
changeset b03ea30335a3