diff --git a/alib2data/src/common/multipleDispatch.hpp b/alib2data/src/common/multipleDispatch.hpp index ccf5879535e984dc42db00fe12dc31fab74b811d..c3dc8253e344a061eb870bf1ff95c738408305bb 100644 --- a/alib2data/src/common/multipleDispatch.hpp +++ b/alib2data/src/common/multipleDispatch.hpp @@ -154,16 +154,21 @@ public: public: ReturnType eval(bool firstAttempt, const ParametersType& first, const ParametersType& second) { + if(first.selfTypeId() == second.selfTypeId()) + return ReturnType(callback((const RealParametersType&) first, (const RealParametersType&) second)); + if(firstAttempt) { alib::Object casted = alib::castApi::getCastPool(first.selfTypeId()).cast(second); return ReturnType(callback((const RealParametersType&) first, (const RealParametersType&) casted.getData())); } else { - alib::Object casted = alib::castApi::getCastPool(first.selfTypeId()).cast(first); + alib::Object casted = alib::castApi::getCastPool(second.selfTypeId()).cast(first); return ReturnType(callback((const RealParametersType&) casted.getData(), (const RealParametersType&) second)); } } bool available(bool firstAttempt, long long first, long long second) { + if(first == second) return true; + if(firstAttempt) return alib::castApi::castAvailable(first, second); else