diff --git a/bob/learn/boosting/lut_machine.cpp b/bob/learn/boosting/lut_machine.cpp index f097b27133eb33fbbcae06ef444a55253cd04dbe..09604fe0f7a7116a7d4afc3c79207167dd2241ad 100644 --- a/bob/learn/boosting/lut_machine.cpp +++ b/bob/learn/boosting/lut_machine.cpp @@ -1,5 +1,7 @@ #include "main.h" +#include +#include static auto lutMachine_doc = bob::extension::ClassDoc( "LUTMachine", @@ -408,7 +410,7 @@ bool init_LUTMachine(PyObject* module) LUTMachineType.tp_methods = lutMachine_Methods; // register machine - if (!registerMachineType(typeid(bob::learn::boosting::LUTMachine).hash_code(), &lutMachineCreate)) + if (!registerMachineType(boost::typeindex::type_id().hash_code(), &lutMachineCreate)) return false; // check that everyting is fine diff --git a/bob/learn/boosting/stump_machine.cpp b/bob/learn/boosting/stump_machine.cpp index 7a4a680e019041acf8f9c2851bf213fb10597abb..53e61ab710b54073633a5a8de2516b6e1f20a30a 100644 --- a/bob/learn/boosting/stump_machine.cpp +++ b/bob/learn/boosting/stump_machine.cpp @@ -1,5 +1,7 @@ #include "main.h" +#include +#include static auto stumpMachine_doc = bob::extension::ClassDoc( "StumpMachine", @@ -410,7 +412,7 @@ bool init_StumpMachine(PyObject* module) StumpMachineType.tp_methods = stumpMachine_Methods; // register machine - if (!registerMachineType(typeid(bob::learn::boosting::StumpMachine).hash_code(), &stumpMachineCreate)) + if (!registerMachineType(boost::typeindex::type_id().hash_code(), &stumpMachineCreate)) return false; // check that everyting is fine diff --git a/bob/learn/boosting/weak_machine.cpp b/bob/learn/boosting/weak_machine.cpp index df99e95af5a426a50a08798be7745d592b3d15ee..812704b185120733c8015c77eadc69d55e1f8e1d 100644 --- a/bob/learn/boosting/weak_machine.cpp +++ b/bob/learn/boosting/weak_machine.cpp @@ -1,5 +1,7 @@ #include "main.h" +#include +#include static std::map machineFactory; @@ -13,7 +15,7 @@ bool registerMachineType(size_t type_hash, CreateFunction creator_function){ } PyObject* createMachine(boost::shared_ptr machine){ - size_t type_hash = typeid(*machine).hash_code(); + size_t type_hash = boost::typeindex::type_id_runtime(*machine).hash_code(); if (machineFactory.find(type_hash) == machineFactory.end()){ PyErr_Format(PyExc_TypeError, "The given machine hash %zu has not been registered.", type_hash); return NULL; @@ -60,7 +62,7 @@ bool init_WeakMachine(PyObject* module){ // register creator function // register machine - if (!registerMachineType(typeid(bob::learn::boosting::WeakMachine).hash_code(), &weakMachineCreate)) + if (!registerMachineType(boost::typeindex::type_id().hash_code(), &weakMachineCreate)) return false; // check that everyting is fine