Hello jsmith,
Thanks for the hint, that was just what I'm looking for.
boost solves the problem by providing a class for each array size (via a template class). As far as I understand, every time I initialize an array with a given size, a new class is deduced from the template. Therefore I'll get many different classes, although only the (initial) size varies. That's not exactly what I'm looking for, but it serves the purpose.
Your code does not compile on my machine though:
1 2 3 4 5 6 7 8 9 10
|
#include <boost/array.hpp>
int main(void) {
boost::array<6> array = { 1, 2, 3, 4, 5, 6 };
return 0;
}
|
gives me the following errors (but it clears your point):
error C2976: 'boost::array' : too few template arguments
error C2552: 'array' : non-aggregates cannot be initialized with initializer list
You can not omit the T template parameter, only the N (size of the array defaults to 0) template parameter.
Still I have to provide the size of the array by myself . . .
It seems as if it's not possible to let the compiler (or preprocessor) fill in the numbers.
Thanks a lot,
Korexio