]> git.mxchange.org Git - simgear.git/commitdiff
add static_pointer_cast for SGSharedPtr
authorThomas Geymayer <tomgey@gmail.com>
Wed, 6 Mar 2013 22:17:02 +0000 (23:17 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Wed, 6 Mar 2013 22:17:02 +0000 (23:17 +0100)
simgear/structure/SGSharedPtr.hxx

index 3de62e6c7cb78819b411e5af6d1feffb31799402..479c197294247e96dbf90c46639863cabbadeb04 100644 (file)
@@ -123,4 +123,13 @@ T* get_pointer(SGSharedPtr<T> const & p)
 {
   return p.ptr();
 }
+
+/**
+ * static_cast for SGSharedPtr
+ */
+template<class T, class U>
+SGSharedPtr<T> static_pointer_cast(SGSharedPtr<U> const & r)
+{
+  return SGSharedPtr<T>( static_cast<T*>(r.get()) );
+}
 #endif