c + +初始化带有std :: list的struct

时间:2018-10-16 15:05:51

标签: c++ struct

我有以下问题。

检查下面的代码块,它可以正确初始化我的结构成员。

typedef struct
{
    int var00;
    int var01;
}struct_;

int main()
{


    struct_ my_struct;
    memset(&my_struct,'\0',sizeof(struct_));
    return 0;
}

我现在的新结构(见下文)还包括一个std :: list。我现在要做的是 将memset命令保留在代码中?

typedef struct
{
    int var00;
    int var01;
    std::list<int> my_list
}struct_list_included;

int main()
{


    struct_list_included my_struct;
    memset(&my_struct,'\0',sizeof(struct_list_included));
    return 0;
}

1 个答案:

答案 0 :(得分:1)

// execute `npm run wd-update` before `npm run e2e`. // If you execute below cmds manually, you can skip to // execute `npm run wd-update` if you had succeed to execute it before. npm run wd-update npm run e2e 不是 POD 类型,所以我认为您不能通过std::list来做到这一点。