Weird pointer to member function syntax

社会主义新天地 提交于 2019-12-05 13:55:49

TYPE host::* is a pointer to a class data member. TYPE is the type of the class member and host::* means pointer to member of host. So TYPE host::* accepts a pointer to any of member of host

Try this instead:

constexpr void my_test(void (S::*)()) {}

That is the correct way to declare a parameter typed pointer to member function of S returning void with no parameters.

http://ideone.com/EqfYmb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!