add StaticCast to mirror DynamicCast and ConstCast
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue Jul 07 13:03:21 2009 +0200 (7 months ago)
changeset 4686b4c5ad3c5fa1
parent 4685 daf9af206d08
child 4687 5b92bfa1abee
add StaticCast to mirror DynamicCast and ConstCast
src/core/ptr.h
     1.1 --- a/src/core/ptr.h	Sat Jul 04 08:54:33 2009 +0200
     1.2 +++ b/src/core/ptr.h	Tue Jul 07 13:03:21 2009 +0200
     1.3 @@ -373,6 +373,13 @@
     1.4    return Ptr<T1> (dynamic_cast<T1 *> (PeekPointer (p)));
     1.5  }
     1.6  
     1.7 +template <typename T1, typename T2>
     1.8 +Ptr<T1>
     1.9 +StaticCast (Ptr<T2> const&p)
    1.10 +{
    1.11 +  return Ptr<T1> (static_cast<T1 *> (PeekPointer (p)));
    1.12 +}
    1.13 +
    1.14  
    1.15  /****************************************************
    1.16   *      Member method implementations.