开发者

including a std::map within a struct? Is it ok?

开发者 https://www.devze.com 2023-02-04 11:30 出处:网络
class X_class{ public: struct extra {int extra1; int extra2; int extra3; }; enum a { n,m}; struct x_struct{ char b;
class X_class{
public:

struct extra
{int extra1;
 int extra2;
 int extra3;
};
enum a
{
 n,m};

struct x_struct{
char b;
char c;
int d;
int e;
std::map <int, extra> myExtraMap;

};
};

in my code I define :

x_struct myStruct;

why do I get compile errors compiling the above class? The er开发者_如何学运维ror either says: 1) expected ; before < on the line --- where I defined the map (above) if I eliminate std:: or 2) error: invalid use of ::; error: expected ; before < token


Probably you get erorrs because you didn't #include <map>

0

精彩评论

暂无评论...
验证码 换一张
取 消