X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fstructure%2FSGWeakReferenced.hxx;h=3bb70ffa6e541178db502667f7de71bc4ab99097;hb=5c9f5361bda56dddad8068d8e45dc08584440d70;hp=7a2bcaf5fae97961181da0a7a826ca516ccf7672;hpb=b2c3a90adfb6c0285d02355fd8ab061b7f2f1e6c;p=simgear.git diff --git a/simgear/structure/SGWeakReferenced.hxx b/simgear/structure/SGWeakReferenced.hxx index 7a2bcaf5..3bb70ffa 100644 --- a/simgear/structure/SGWeakReferenced.hxx +++ b/simgear/structure/SGWeakReferenced.hxx @@ -121,12 +121,7 @@ private: boost::is_base_of, T* >::type - up_cast(SGWeakReferenced* ptr) - { - // First get the virtual base class, which then can be used to further - // upcast. - return dynamic_cast(static_cast(ptr)); - } + up_cast(SGWeakReferenced* ptr); /// Upcast in a non-virtual class hierarchy template @@ -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 +typename boost::enable_if< + boost::is_base_of, + 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(static_cast(ptr)); +} + #ifdef _MSC_VER # pragma warning(pop) #endif