How can I feel struct with foreach loop?
struct ConfigStruct
{
string [string] key1;
string [string] key2;
}
ConfigStruct confstruct;
foreach (i, line; readText(ConfigName).splitLines())
{
string [] keyvalue = line.split(=);
confstruct.key1[keyvalue[0]] = keyvalue[1];
}
it's ok for 1
On Saturday, 23 August 2014 at 01:56:06 UTC, Dicebot wrote:
On Saturday, 23 August 2014 at 01:32:13 UTC, Meta wrote:
On Saturday, 23 August 2014 at 01:24:10 UTC, Meta wrote:
What is happening here? Are these two extra ulongs the
offsets of the fields in the struct?
And I just realized that
On 08/23/2014 10:21 AM, Meta wrote:
On Saturday, 23 August 2014 at 01:56:06 UTC, Dicebot wrote:
On Saturday, 23 August 2014 at 01:32:13 UTC, Meta wrote:
On Saturday, 23 August 2014 at 01:24:10 UTC, Meta wrote:
What is happening here? Are these two extra ulongs the offsets of
the fields in the
On Saturday, 23 August 2014 at 20:34:35 UTC, Ali Çehreli wrote:
There are a number of inconsistencies around tuples. The
behavior you expect is present for ranges that return tuple
fronts:
import std.stdio;
import std.typecons;
import std.range;
void main()
{
auto t = [ tuple(1.5, 100),
Something weird happens when I try to foreach over test.tupleof.
If the foreach loop has 2 variables like so:
struct Test
{
string name = 'null';
int id;
}
void main()
{
auto test = Test();
assert(test.name == 'null');
assert(test.id == 0);
On Saturday, 23 August 2014 at 01:24:10 UTC, Meta wrote:
What is happening here? Are these two extra ulongs the offsets
of the fields in the struct?
And I just realized that that's obviously not the case. It's just
an iteration variable. Problem solved.
On Saturday, 23 August 2014 at 01:32:13 UTC, Meta wrote:
On Saturday, 23 August 2014 at 01:24:10 UTC, Meta wrote:
What is happening here? Are these two extra ulongs the offsets
of the fields in the struct?
And I just realized that that's obviously not the case. It's
just an iteration