From 8737ec5f97e280e8a5d3b0386f48ddc22a8e176b Mon Sep 17 00:00:00 2001 From: Zhang Yu Date: Mon, 30 Nov 2020 22:12:00 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20=E4=BF=AE=E5=A4=8Dconst=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=97=A0=E6=B3=95=E7=BC=96=E8=AF=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit const成员函数有匹配导致编译错误 --- stub-ext/stub-shadow.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stub-ext/stub-shadow.h b/stub-ext/stub-shadow.h index 523244a..063ab89 100644 --- a/stub-ext/stub-shadow.h +++ b/stub-ext/stub-shadow.h @@ -119,6 +119,22 @@ struct FuncShadow } }; +template +struct FuncShadow +{ + typedef Ret (*Shadow)(Obj *,Args...); + typedef Ret RetType; + static Ret call(Obj *obj, Args ...args) + { + Shadow shadow = &call; + long id = (long)shadow; + auto iter = stub_wrappers.find(id); + assert(stub_wrappers.find(id) != stub_wrappers.end()); + LamdaWrapper *wrapper = dynamic_cast *>(iter->second); + return LamdaCaller::call(wrapper, obj, args...); + } +}; + template typename FuncShadow::Shadow depictShadow(Wrapper **wrapper, Func func, Lamda lamda) { -- Gitee