struct vs built-in type

2014-12-17 Thread Jack Applegame via Digitalmars-d-learn
Code: import std.stdio; struct Bar { int payload; alias payload this; } struct Foo { private { Bar m_bar; int m_baz; } @property { Bar bar() { return m_bar; } void bar(Bar v) { m_bar = v; }

Re: Russian translation of the "range" term?

2014-11-12 Thread Jack Applegame via Digitalmars-d-learn
"интервал", "область"

std.array.array and immutable elements

2014-11-07 Thread Jack Applegame via Digitalmars-d-learn
DMD64 D Compiler v2.066.1 Why second call doesn't compile? import std.array; import std.algorithm; class Foo { bool flag; } void main() { immutable(Foo)[] foos; foreach(i; 0..5) foos ~= new Foo; // compiles, typeof(bar1) == immutable(Foo)[] auto bar1 = array(foos.filter!

Re: transversal sum

2014-11-06 Thread Jack Applegame via Digitalmars-d-learn
void popFront() { foreach (ref r; rr) r.popFront(); } I think it should be void popFront() { foreach (ref r; rr.save) r.popFront(); } but I think OP wanted a ready-made phobos solution, w/o all the range boilerplate... exactly.

transversal sum

2014-11-06 Thread Jack Applegame via Digitalmars-d-learn
I have rectangular forward range of forward ranges (not arrays): [ [a11, a12, ... a1N], [a21, a22, ... a2N], ... [aM1, aM2, ... aMN] ] I need lazy forward range: [ a11 + a21 + ... aM1, a12 + a22 + ... aM2, ... a1N + a2N + ... aMN ] Range of sum elements of every columns; M, N - runti

Why std.variant.Varian.get is mutable

2014-10-21 Thread Jack Applegame via Digitalmars-d-learn
This doesn't compiles http://dpaste.dzfl.pl/bbcc31fbe016

Very strange compilation error

2014-10-15 Thread Jack Applegame via Digitalmars-d-learn
I don't understand why this code doesn't compile: http://dpaste.dzfl.pl/dfd8df7f80ad

<    1   2