I'm currently learning C++ and I'm messing around with constructors/operators.
I have an array:
int x(1);
int a[] = { int(x), int(x), int(x) };
How can I construct the same array dynamically using the object's copy constructor? I also don't wanna use the = operator.
So something like:
int* b;
for (int i = 0; i < DESIRED_ARRAY_SIZE; i += 1)
{
b[i](int(x));
}
Of course the above doesn't work. This is strictly for learning purposes, so I'm wondering if this is possible. I'm also wondering if there's a special case for primitives vs classes, as I'm currently testing with int
atm.