Topic: New feature "array element initializers
Author: "ALL YOUR BASE ARE BELONG TO US" <spamme@lots.UCAR.EDU>
Date: Fri, 16 Mar 2001 18:47:34 GMT Raw View
I'd like to suggest a new feature: "array element initializers".
If you have a member variable which is an array,
it would be nice to initialize specific elements in the
array, as shown in the following code:
class A
{
A();
A(int);
};
class B
{
A array[10];
// Initialize specific array elements
// Remaing elements naturally receive automatic initialization
B() : array[3]( 6 ), array[9]()
{
}
};
The array indices would have to be distinct sequences of constants
limited to the array bounds. Otherwise you might end up initializing
the same thing twice (e.g. if i == 0 then [1][2] and [i + 1][2 - i] would
conflict.).
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]