我试图将其减少到最低限度:
#include <array>
template <std::size_t N>
void f(int, std::array<int, N> const & =
std::array<int, 0>()) {
}
int main() {
f(10);
}array_test.cpp:4:6:注意:模板参数推导/替换失败: array_test.cpp:10:9:注意:无法推导模板参数‘N’f(10);
为什么这会失败?我不明白:它应该是可以从默认参数中推导出来的。我需要一个变通方法。
https://stackoverflow.com/questions/41587485
复制相似问题