On 09/26/2011 12:04 AM, Andrej Mitrovic wrote:
This should make things clearer for you:
fittest
{
auto h1 = get(1);
auto h2 = get(2);
assert(h1 is h2); // both reference the same array
}
Field initialization is only done once (once per thread, or if a field
is shared once on
I have this small program, which does some data handling with structs:
struct App {
private int[] fData;
this(size_t initialSize) {
fData = new int[initialSize];
}
void put(int i) {
fData[0] = i;
}
int[] get() {
return fData;
}
}
struct Builder {
int i;
App app =
This should make things clearer for you:
unittest
{
auto h1 = get(1);
auto h2 = get(2);
assert(h1 is h2); // both reference the same array
}
Field initialization is only done once (once per thread, or if a field
is shared once on app start) and not each time you call the
On Sunday, September 25, 2011 23:40:36 Christian Köstlin wrote:
I have this small program, which does some data handling with structs:
struct App {
private int[] fData;
this(size_t initialSize) {
fData = new int[initialSize];
}
void put(int i) {
fData[0] = i;
}
On Monday, September 26, 2011 00:04:48 Andrej Mitrovic wrote:
This should make things clearer for you:
unittest
{
auto h1 = get(1);
auto h2 = get(2);
assert(h1 is h2); // both reference the same array
}
Field initialization is only done once (once per thread, or if a