// This compiles and runs properly
using MemPtr = Entity&(OBFactory::*)(const Vec2i&, float);
void test(MemPtr mptr, const Vec2i& p, float d)
{
(getFactory().*mptr)(p, d);
}
// "no matching function for call to `test`,
// failed candidate template argument deduction"
template<typename... A> using MemPtr = Entity&(OBFactory::*)(A...);
template<typename... A> void test(MemPtr<A...> mptr, const Vec2i& p, float d)
{
(getFactory().*mptr)(p, d);
}
...
// I call both versions with
test(&OBFactory::func, Vec2i{0, 0}, 0.f);
为什么可变参数模板版本不起作用?我错过了一些转发吗?