Is it possible to declare a const array (possibly constexpr) at one point, then define it at another place, one element at a time?
E.g.
extern constexpr int myArray[100];
myArray[0] = myConstexprFunction(0);
myArray[1] = myConstexprFunction(1);
// ...
myArray[100] = myConstexprFunction(100);
What I'm trying to do will need something like this. Maybe it's possible using things like: http://ift.tt/1Iw9LfT
But if this technique is going to be illegal in the next C++ standard (I hope not) I would like to use a safer one.
Aucun commentaire:
Enregistrer un commentaire