读书人

set的使用异常

发布时间: 2012-03-01 10:25:47 作者: rapoo

set的使用错误?
#pragma warning(disable:4786)
#include <set>
#include <vector>
#include <iostream>
using namespace std;

enum eValueType { P6V = 0, P6C = 1, P25V = 2, P25C = 3, N25V = 4, N25C = 5 };
typedef set < eValueType, string > ::value_type SetType;

void main()
{

set < eValueType, string > CommandsSet;
CommandsSet.insert( SetType( P6V, "MEAS:VOLT? P6V " ) );
CommandsSet.insert( SetType( P6C, "MEAS:CURR? P6V " ) );
CommandsSet.insert( SetType( P25V, "MEAS:VOLT? P25V " ) );
CommandsSet.insert( SetType( P25C, "MEAS:CURR? P25V " ) );
CommandsSet.insert( SetType( N25V, "MEAS:VOLT? N25V " ) );
CommandsSet.insert( SetType( N25C, "MEAS:CURR? N25V " ) );
}

编译错误:
error C2564: 'enum eValueType ' : function-style conversion to builtin type takes only one argument

谢谢!

[解决办法]
兄弟啊,你在哪学的set的语法?set只能放一个类型啊。
你现在搞的那是map了。

读书人网 >C++

热点推荐