DynamicAny::extract performance optimization

This commit is contained in:
Aleksandar Fabijanic 2008-05-13 01:41:27 +00:00
parent 45d601089b
commit e933e93b50

View File

@ -168,9 +168,11 @@ public:
/// the stored value, otherwise a BadCastException
/// is thrown.
{
DynamicAnyHolderImpl<T>* pHolder = dynamic_cast<DynamicAnyHolderImpl<T>*>(_pHolder);
if (pHolder)
if (_pHolder && _pHolder->type() == typeid(T))
{
DynamicAnyHolderImpl<T>* pHolder = static_cast<DynamicAnyHolderImpl<T>*>(_pHolder);
return pHolder->value();
}
else
throw BadCastException();
}