Skip to content

Commit

Permalink
Use unique id, not typeid reference which may differ
Browse files Browse the repository at this point in the history
Between different translation units, typeid itself is allowed to differ
but hash_code will be the same type

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Aug 27, 2019
1 parent 7678a9d commit 728c26c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OpenEXR/IlmImfTest/testCompositeDeepScanLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class data

data() : _inserting_result(false),_started(false)
{
if(typeid(T)==typeid(half))
if(typeid(T).hash_code()==typeid(half).hash_code())
{
_type = OPENEXR_IMF_NAMESPACE::HALF;
}
Expand Down
4 changes: 2 additions & 2 deletions PyIlmBase/PyIex/PyIexTypeTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ template <class T>
typename TypeTranslator<BaseClass>::ClassDesc *
TypeTranslator<BaseClass>::findClassDesc (ClassDesc *cd)
{
if (cd->typeInfo() == typeid (T))
if (cd->typeInfo().hash_code() == typeid (T).hash_code())
return cd;

for (int i = 0; i < cd->numDerivedClasses(); ++i)
Expand All @@ -259,7 +259,7 @@ template <class T>
const typename TypeTranslator<BaseClass>::ClassDesc *
TypeTranslator<BaseClass>::findClassDesc (const ClassDesc *cd) const
{
if (cd->typeInfo() == typeid (T))
if (cd->typeInfo().hash_code() == typeid (T).hash_code())
return cd;

for (int i = 0; i < cd->numDerivedClasses(); ++i)
Expand Down

0 comments on commit 728c26c

Please sign in to comment.