I've found the following solution which ensure that
- The array is computed at compile time
- The array is stored in the struct without being copied.
The idea is to use a const reference on a constexpr array.
struct Bar {
int i;
static const std::array<Bar, 2> &A;
};
constexpr const std::array<Bar, 2> BarA {{{1},{2}}};
const std::array<Bar, 2> &Bar::A = BarA;