我正在尝试结合使用 std::set 和类,如下所示:
#include <set>
class cmdline
{
public:
cmdline();
~cmdline();
private:
set<int> flags; // this is line 14
};
但是,它不喜欢设置的标志;部分:
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)。您是否以不同方式编写“设置变量”行,还是那里不允许?
最佳答案
你需要使用std::set
; set
位于 std
命名空间中。
关于c++ - 在类中使用 std::set ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1575240/