Skip to content

Commit 69e97f2

Browse files
committed
CallbackSized: make it a distinct type (not a using alias)...
...to preserve the API for functions using this in their arguments prior to f10b7eb
1 parent 61313f0 commit 69e97f2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

util/callable.hh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,19 @@ private:
7676
template<typename Signature>
7777
using Function = FunctionSized<sizeof(void *) * 2, Signature>;
7878

79+
7980
template<unsigned size = sizeof(void *) * 2>
80-
using CallbackSized = FunctionSized<size, void(void)>;
81+
struct CallbackSized : FunctionSized<size, void(void)>{
82+
CallbackSized() = default;
83+
84+
template<typename Callable>
85+
CallbackSized(Callable callable) : FunctionSized<size, void(void)>{callable}{}
86+
87+
};
88+
// Note: we could just define CallbackSized like the following, but
89+
// that breaks the API for functions using CallbackSized in their signature
90+
// template<unsigned size = sizeof(void *) * 2>
91+
// using CallbackSized = FunctionSized<size, void(void)>;
8192

8293
using Callback = CallbackSized<2 * sizeof(void *)>;
94+

0 commit comments

Comments
 (0)