template<typename TCallable>
void Fun(TCallable c){
...
}
Run Code Online (Sandbox Code Playgroud)
如何c在int(double, double)不使用std :: function的情况下指示前面的代码中必须有一些特定的签名(比方说)?
看起来你可以添加static_assert(std::is_same<decltype(c(0.0,0.0)), int>::value, "c must take two doubles and return int").
| 归档时间: |
|
| 查看次数: |
144 次 |
| 最近记录: |