我正在尝试结合使用std::set和一个类,就像这样:
#include <set>
class cmdline
{
public:
cmdline();
~cmdline();
private:
set<int> flags; // this is line 14
};
但是,它不喜欢“set flags”部分。
cmdline.hpp:14: error: ISO C++ forbids declaration of 'set' with no type
cmdline.hpp:14: error: expected ';' before '<' token
make: *** [cmdline.o] Error 1
据我所见,我给了一个 int 类型。你是否应该以不同的方式编写“设置变量”行,或者那里不允许这样做?