ITPub博客

首页 > > > vc6.0中set容器使用不了函数对象

vc6.0中set容器使用不了函数对象

作者:choubou 时间:2019-10-21 14:00:26 0 删除 编辑

#include

#include

#include

using namespace std;

void Print(set> setInt)

{

set>::iterator it;

for (it = setInt.begin(); it != setInt.end(); it++)

{

cout << *it <<  endl;

}

}

int main(int argc, char *argv[])

{

set> setInt;

setInt.insert(3);

setInt.insert(1);

setInt.insert(2);

setInt.insert(1);

 Print(setInt);

return 0;

}

C:\Users\asus\Desktop\test\setMultiset\main.cpp(7) : error C2146: syntax error : missing ',' before identifier 'setInt'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(7) : error C2065: 'setInt' : undeclared identifier

C:\Users\asus\Desktop\test\setMultiset\main.cpp(7) : error C2143: syntax error : missing ',' before ')'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(8) : error C2143: syntax error : missing ';' before '{'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(9) : error C2039: 'iterator' : is not a member of 'greater'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(9) : error C2146: syntax error : missing ',' before identifier 'it'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(9) : error C2065: 'it' : undeclared identifier

C:\Users\asus\Desktop\test\setMultiset\main.cpp(9) : error C2143: syntax error : missing '>' before ';'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(11) : error C2143: syntax error : missing ')' before ';'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(11) : error C2059: syntax error : ')'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(12) : error C2143: syntax error : missing ';' before '{'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(14) : error C2143: syntax error : missing ';' before '}'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(15) : error C2143: syntax error : missing ';' before '}'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(17) : error C2146: syntax error : missing ',' before identifier 'argv'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(17) : error C2065: 'argv' : undeclared identifier

C:\Users\asus\Desktop\test\setMultiset\main.cpp(17) : error C2059: syntax error : ']'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(18) : error C2143: syntax error : missing ';' before '{'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(19) : error C2146: syntax error : missing ',' before identifier 'setInt'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(19) : error C2143: syntax error : missing '>' before ';'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(29) : error C2143: syntax error : missing ';' before '}'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(30) : error C2143: syntax error : missing ';' before '}'

C:\Users\asus\Desktop\test\setMultiset\main.cpp(30) : fatal error C1001: INTERNAL COMPILER ERROR

(compiler file 'Y?, line 1)

Please choose the Technical Support command on the Visual C++

Help menu, or open the Technical Support help file for more information

Error executing cl.exe.

为什么set使用不了greater等函数对象,去掉greater程序正确运行,一加上就有错误,求大神解答?

我是在vc6.0中运行的

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4548/viewspace-3138271/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-10-08

  • 博文量
    175
  • 访问量
    10713