I have the following C++ code (in VS2017),
struct OptionA
{
std::string s1;
};
struct OptionB
{
std::string s2;
};
struct Inner
{
int b;
union {
OptionA optA;
OptionB optB;
}Options;
};
When I tried to declare this struct:
void function()
{
Outer obj;
}
I get the compilation error:
error C2280: 'Outer::Outer(void)': attempting to reference a deleted function
This way of declaring a struct should work fine. I feel this error is something to do with the constructor of the structure. How do I solve this issue ?
Aucun commentaire:
Enregistrer un commentaire