Reputation: 1321
Is there a compile time expression to copy an array in an object constructor? What does the default constructor use? I want something like this:
struct A
{
int arr[100];
// I want something like this:
A(const A& arg) : arr{arg.arr...} {}
// what I use at the moment (a compile time loop):
A(const A& arg)
{
static_for<0, N>([&](auto i) { arr[i] = arg.arr[i]; });
}
};
I do not want to use std::array
, and I have some debug info in the copy ctor, so I cannot rely on the default one.
Upvotes: 1
Views: 337