That's a fantastic answer! Thank you. I was not aware that
initializers were always compile time, that was the missing piece
in my understanding.
It's a shame that I can't use the nicer (IMO) syntax, but the
reasoning is sound.
Consider the following:
class A
{
int x;
}
class B
{
A a = new A; // I would expect this to be called for each
"new B".
}
void main()
{
import std.stdio;
auto c = new B;
writeln("c ", c.a.x);
c.a.x++;
writeln("c ", c.a.x);
writeln;
auto d = new B;
wri
I'm not sure if "Template Oriented Programming" seems to be the
way to go in D, but I've got my head mainly stuck around OOP.
I'm a bit confused about how to dive into it.
With OOP, we create interfaces, which provide a contract that all
implementers of the interface have to abide by. Delegati
Everything is fine until I try to instantiate Tuples with my
arrays. Then I get an error that says none of the overloads of
the constructor are callable with these arguments. But I see
this: http://dlang.org/phobos/std_typecons.html#.Tuple.this.2 ,
which makes me think it should work. Am I do
auto result = input
.splitter(',')
.map!splitter
.joiner
.map!(to!int)
.chunks(2)
.map!array
.array
.sort()
.retro;
Thanks for th
Hi,
I have a string of pairs of integers, where pairs are delimited
from each other by commas, and members of the pair are delimited
by a space. I'd like to end up with something like a range of
2-tuples, which I can then sort with a lambda. I'm running into
problems trying to do this, after