]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/SGWeakReferenced.hxx
Fix for libCurl pipelining and connection count.
[simgear.git] / simgear / structure / SGWeakReferenced.hxx
index 7a2bcaf5fae97961181da0a7a826ca516ccf7672..3bb70ffa6e541178db502667f7de71bc4ab99097 100644 (file)
@@ -121,12 +121,7 @@ private:
       boost::is_base_of<SGVirtualWeakReferenced, T>,
       T*
     >::type
-    up_cast(SGWeakReferenced* ptr)
-    {
-      // First get the virtual base class, which then can be used to further
-      // upcast.
-      return dynamic_cast<T*>(static_cast<SGVirtualWeakReferenced*>(ptr));
-    }
+    up_cast(SGWeakReferenced* ptr);
 
     /// Upcast in a non-virtual class hierarchy
     template<class T>
@@ -183,6 +178,20 @@ class SGVirtualWeakReferenced:
     virtual ~SGVirtualWeakReferenced() {}
 };
 
+/// Upcast in a class hierarchy with a virtual base class
+// We (clang) need the definition of SGVirtualWeakReferenced for the static_cast
+template<class T>
+typename boost::enable_if<
+  boost::is_base_of<SGVirtualWeakReferenced, T>,
+  T*
+>::type
+SGWeakReferenced::WeakData::up_cast(SGWeakReferenced* ptr)
+{
+  // First get the virtual base class, which then can be used to further
+  // upcast.
+  return dynamic_cast<T*>(static_cast<SGVirtualWeakReferenced*>(ptr));
+}
+
 #ifdef _MSC_VER
 # pragma warning(pop)
 #endif