From 3dce8b2c239e3205fc7850ee985b4da827581f0d Mon Sep 17 00:00:00 2001 From: DarkSharpness <2040703891@qq.com> Date: Thu, 11 Jul 2024 22:12:29 +0800 Subject: [PATCH] fix(wire): fix the wrong definition of wire function --- include/wire.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/wire.h b/include/wire.h index 64d7015..77bcb31 100644 --- a/include/wire.h +++ b/include/wire.h @@ -8,12 +8,11 @@ namespace dark { namespace details { template -concept WireFunction = requires(_Fn &&func) { - { func() } -> concepts::bit_convertible <_Len>; -}; +concept WireFunction = + concepts::bit_convertible >, _Len>; struct FuncBase { - using _Ret_t = int; + using _Ret_t = max_size_t; using _Cpy_t = FuncBase *; virtual _Ret_t call() const = 0; virtual _Cpy_t copy() const = 0; @@ -27,7 +26,7 @@ struct FuncImpl final : FuncBase { template FuncImpl(_Tp &&fn) : _M_lambda(std::forward <_Tp> (fn)) {} - _Ret_t call() const override { return this->_M_lambda(); } + _Ret_t call() const override { return static_cast <_Ret_t> (this->_M_lambda()); } _Cpy_t copy() const override { return new FuncImpl(*this); } };