Questions about initialization of array of objects
Andrey
andr-sar at yandex.ru
Sat Jan 12 11:07:37 PST 2013
I'm not sure about proper understanding of RAII idiom, but should
objects in array be automatically constructed during array
initialization?
Example.
class ClassPoint {
int x,y;
}
struct StructPoint {
int x,y;
}
ClassPoint[8] arr; //static array of null references;
StructPoint[8] arr2;
arr[0].x=1 //error, there is no object
arr2[0].x=1 //OK.
Here I have two questions:
1) Can you have automatically constructed objects with default
class constructor?
2) Can you setup memory attributes for static array using
core.memory functions, say, to force GC not to scan this portion
of memory during collection?
More information about the Digitalmars-d-learn
mailing list