Printing an std.container.Array

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 16 14:18:49 PDT 2015


On Thursday, 16 April 2015 at 20:34:19 UTC, Steven Schveighoffer 
wrote:
> On 4/16/15 4:18 PM, Panke wrote:
>>>
>>> Yep, but problem is almost no one expect this, or know this. 
>>> We
>>> definitely
>>> should do better.
>>
>> How?
>
> By doing what is expected. Print the array contents. See my new 
> comment in that PR.
>
> -Steve

I think that this action should print the contents of the 
container, not it's type, ie [1, 2, 3, 4]:

import std.stdio : writeln;
import std.container.rbtree : redBlackTree;

void main() {

	auto a = redBlackTree(1, 2, 1, 3, 4, 3);

	writeln(a);
	// std.container.rbtree.RedBlackTree!(int, "a < b", 
false).RedBlackTree
}

Will it be modified in future versions of DMD?


More information about the Digitalmars-d-learn mailing list