What is the matter of the error, which produces the following code?
struct foo
{
void call(void (foo::*ptr)()) &&
{
(*this.*ptr)();
}
};
How to fix this error?
由于成员指针具有 rvalue 限定符,因此必须告诉编译器*this
将通过在其上使用std::move
被视为右值:
(std::move(*this).*ptr)();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.