std :: vector的默认参数<std :: pair <int,int =“”>&gt; </std :: pair <int,>

时间:2012-09-22 09:12:41

标签: c++

这是我的代码

void push(const PetModel& petModel, const std::string& host, UInt8 side,
     bool full = false, const std::string& master = "", 
     const std::vector<std::pair<UInt8, UInt8> >& skill
              = std::vector<std::pair<UInt8, UInt8> >());  // This is the error Occur

并且编译器说:

 error: expected ‘,’ or ‘...’ before ‘>’ token
 error: wrong number of template arguments (1, should be 2)

我在SLES中使用Gcc 4.1.2。我写了一个演示,演示工作。那是gcc的错误吗?

#include <iostream>
#include <vector>
#include <map>


void fun(int a , int b , int c, int d = 0, int e = 0,          
         int f = 0, const std::vector<std::pair<int, int> >& v = std::vector<std::pair<int, int> >()) {
}


int main() {
  fun(1, 2, 3);
}

这是演示。

0 个答案:

没有答案