Class 关于嵌套结构和实例检查的疑问

Class 关于嵌套结构和实例检查的疑问,class,c++11,nested,Class,C++11,Nested,我有一个嵌套结构的类,它从两个不同的设备接收数据 class Command { public: struct A { uint8_t A_command; std::vector<std::string> A_fields; }; struct B { uint16_t B_command; uint16_t B_command_alt; std::vector<std

我有一个嵌套结构的类,它从两个不同的设备接收数据

class Command
{
  public:

    struct A
    {
      uint8_t A_command;
      std::vector<std::string> A_fields;
    };

    struct B
    {
      uint16_t B_command;
      uint16_t B_command_alt;
      std::vector<std::string> B_fields;
    };

    A a_cmd;
    B b_cmd;
};
但当试图检查某些结构是否与零不同时,编译器会发送此消息

  if (command.a_cmd != 0)
  {
    std::cout << "Command A was received" << std::endl;
  }
if(command.a_cmd!=0)
{

std::cout结构为零意味着什么?您可能是想检查结构的
a_命令
成员,如
command.a_cmd.a_命令!=0
  if (command.a_cmd != 0)
  {
    std::cout << "Command A was received" << std::endl;
  }