如何解决模板参数数量错误
有人可以在这里指出错误吗?我使用pair<pair<int,int>,int>
作为密钥,但出现此错误:
prog.cpp: In member function ‘int
Solution::findMaxForm(std::vector<std::__cxx11::basic_string<char> >&,int,int)’:
prog.cpp:33:24: error: wrong number of template arguments (1,should be at least 2)
map<p<p<int,int> fma;
这是我的代码:
#include <bits/stdc++.h>
using namespace std;
#define p pair
#define mp make_pair
class Solution {
public:
int oz(int i,int s,int a[][2],int m,int n,map<p<p<int,int> &fma){
if(i>=s || (m+n)==0) return 0;
int ans;
if(fma.find(mp(mp(m,n),i)) !=fma.end()) return fma[mp(mp(m,i)];
ans =max(1+oz(i+1,s,a,m-a[i][0],n-a[i][1],fma),oz(i+1,m,n,fma));
fma[mp(mp(m,i)]=ans;
return ans;
}
int findMaxForm(vector<string>& strs,int n) {
int s=strs.size();
int a[s][2];
//some code
map<p<p<int,int> fma;
return oz(0,fma);
}
};
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。