Comment #0 by bearophile_hugs — 2011-05-07T06:13:17Z
This little program:
import std.stdio, std.container;
void main() {
auto t = redBlackTree(0, 7, 5, 2);
writeln(t);
writeln(t[]);
}
Prints (DMD 2.053 beta):
std.container.RedBlackTree!(int).RedBlackTree
[0, 2, 5, 7]
But often I'd like collections to print something that's able to generate the data structure again, as in Python:
>>> s = set([1, 2, 3])
>>> s
set([1, 2, 3])
>>> l = [1, 2, 3]
>>> l
[1, 2, 3]
>>> d = {1:1, 2:2, 3:3}
>>> d
{1: 1, 2: 2, 3: 3}
This is very useful for debugging, logging, for quick scripts, etc.
So I'd like one of the two (the first one?) to print something more like this instead:
redBlackTree(0, 2, 5, 7)
This too is acceptable:
std.container.redBlackTree(0, 2, 5, 7)