Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
This post was edited and submitted for review 2 years ago and failed to reopen the post:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
如下情况又如何呢?
我的意思是...如果您想通过 std::enable_if 启用/禁用类的方法,您必须检查依赖于该方法的模板(类型或值)的测试,而不是班级的。
所以
不起作用,因为
COND
是该类的模板值;您必须使用该方法的模板值,因此您可以添加一个模板值CC
,您可以默认为COND
并选中
CC
而不是COND
What about as follows?
I mean... if you want enable/disable a method of a class through
std::enable_if
, you have to check a test that depend from a template (type or value) of the method, not of the class.So
doesn't works because
COND
is a template value of the class; you have to use a template value of the method, so you can add a template valueCC
, that you can default toCOND
and check
CC
instead ofCOND