I have a class and a const variable.
struct A
{
int b;
};
A const a;
The class A
is POD and can be initialized like this.
A const a = { 3 };
IMHO, it looks fine to have a constructor like this.
struct A
{
int b;
A(int newB) : b(newB)
{
}
};
But Clang assumes A
as non-aggregate type. Why I can't have constructor like that? Or should I do something else?
I modified question to present my original meaning. I had wrote the struct
as class
by mistake, and sorry for @Johannes about confusing :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…