S
Simon Elliott
I have some legacy code which initialises an array using C syntax like
this:
struct bar
{
int i1_;
int i2_;
bool b1_;
};
int main(int argc, char **argv)
{
bar myBar[] =
{
{1,2,false},
{2,2,true},
};
return 0;
}
I now want to use struct bar in C++ and give it a constructor or two:
struct bar
{
bar(void):i1_(0),i2_(0),b1_(false){}
bar(int i1, int i2, bool b1):i1_(i1),i2_(i2),b1_(b1){}
int i1_;
int i2_;
bool b1_;
};
Is there any way I can still use the above syntax for initialising an
array of bar?
this:
struct bar
{
int i1_;
int i2_;
bool b1_;
};
int main(int argc, char **argv)
{
bar myBar[] =
{
{1,2,false},
{2,2,true},
};
return 0;
}
I now want to use struct bar in C++ and give it a constructor or two:
struct bar
{
bar(void):i1_(0),i2_(0),b1_(false){}
bar(int i1, int i2, bool b1):i1_(i1),i2_(i2),b1_(b1){}
int i1_;
int i2_;
bool b1_;
};
Is there any way I can still use the above syntax for initialising an
array of bar?