Bug 382 - feature request: templated DynamicCast
feature request: templated DynamicCast
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P3 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-18 10:07 UTC by Tom Henderson
Modified: 2008-10-20 02:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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