Hi Erik,
I think a better solution (that you can implement yourself) would be to use a non-member template function such as:
Code:
// Warning: untested code!
namespace IceUtil
{
template<typename T, typename Y> inline Handle<T>
staticCast(const HandleBase<Y>& p)
{
return Handle<T>(static_cast<T*>(p.get()));
}
}
and then invoke this staticCast with:
Code:
FooPtr x = staticCast<Foo>(bar);
instead of
Code:
FooPtr x = FooPtr::staticCast(bar);
(perhaps you can update the template to get staticCast<FooPtr>(bar))
We didn't use this syntax in Ice because older C++ compilers don't support well the function<type>(...) syntax.
Best regards,
Bernard