From 8750b06e9b222ecca183e58246cccaa1bee7d1f0 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 13 Aug 2015 09:56:06 +0200 Subject: [PATCH] fix handling same types in promoting visitor --- alib2data/src/common/multipleDispatch.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/alib2data/src/common/multipleDispatch.hpp b/alib2data/src/common/multipleDispatch.hpp index ccf5879535..c3dc8253e3 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 -- GitLab