suggest we have an array of class A’s objects, and class A’s constructor require two arguments, like this:
class A
{
public:
A( int i, int j ) {}
};
int main()
{
const A a[3] = { /*How to initialize*/ };
return 0;
}
How to initialize that array?
Say:
On older compilers, and assuming
Ahas an accessible copy constructor, you have to say:C++ used to be pretty deficient with respect to arrays (certain initializations just were not possible at all), and this got a little better in C++11.