我正在尝试使用 boost scope_guard
我需要将成员函数的函数指针发送到 make_guard 函数
我通过以下方式进行了尝试:
class A
{
HRESULT foo(int x);
HRESULT foo_1(int x);
}
STDMETHODIMP A::foo(int x)
{....};
STDMETHODIMP A::foo_1(int x)
{
boost::scope_guard xyz=
boost::make_guard(&A::foo, x);
}
但它给出了编译错误:
E:\ThirdPartyCore\Boost\1_43_0\winx64\include\boost/multi_index/detail/scope_guard.hpp(103) : error C2064: term does not evaluate to a function taking 1 arguments
E:\ThirdPartyCore\Boost\1_43_0\winx64\include\boost/multi_index/detail/scope_guard.hpp(103) : while compiling class template member function 'void boost::multi_index::detail::scope_guard_impl1<F,P1>::execute(void)'
with
[
F=HRESULT (__cdecl A::* )(int),
P1=int
]
see reference to class template instantiation 'boost::multi_index::detail::scope_guard_impl1<F,P1>' being compiled
with
[
F=HRESULT (__cdecl A::* )(int),
P1=int
]
AGPSEngine - 1 error(s), 0 warning(s)
任何人都可以帮我修复它。