0
有谁知道,问题在哪里?看看代码片段。模板参数演绎失败,用stoi功能
template <typename V>
struct Tcn {
template <typename Callable, typename... Args>
Tcn (const string& val, Callable callable, Args... args) {
value = callable (val, args...);
}
V value;
};
int foo (const string& s, size_t* idx = 0, int base = 10) { return {}; }
Tcn<int> tcn1 {"Hello", foo, static_cast<size_t*> (nullptr), 10};
Tcn<int> tcn2 {"Hello", stoi, static_cast<size_t*> (nullptr), 10};
在这里,tcn2会导致问题,但为什么? foo和stoi的原型似乎是相同的。
什么是错误讯息? – Xiao 2015-02-24 21:18:06