【发布时间】:2018-10-25 12:47:14
【问题描述】:
我试着写这样的代码:
#include <string>
#include <vector>
#include <utility>
using namespace std::string_literals;
int main(){
std::vector v{1,2,3};
std::pair p{1,"a"s};
//std::vector<std::pair> vp{{1,"a"s}, {2, "b"s},{3,"c"s}}; // ERROR
}
但是它在pair是vector的模板参数的那一行给出了编译错误。
有没有办法让类模板推导在这里工作,还是我需要为配对指定模板参数?
【问题讨论】:
-
@PiotrNycz tnx,已修复