On Thu, Apr 16, 2015 at 07:55:52PM +0000, Bayan Rafeh via Digitalmars-d-learn wrote: > Executing this code: > > import std.container.array; > import std.stdio; > > > int main() { > writeln(Array!int([1, 2])); > return 0; > } > > outputs the following: > > Array!int(RefCounted!(Payload, > cast(RefCountedAutoInitialize)0)(RefCountedStore(B694B0))) > > > The strange thing is that this works fine: > > import std.container.array; > import std.stdio; > > int main() { > writeln(Array!int([1, 2])[0..$]); > return 0; > } > > [1, 2] > > How am I supposed to interpret this?
Try slicing the Array before passing it to writeln? writeln(Array!int([1, 2])[]); Basically, there is a distinction between a container and a range that spans the items in a container. The conventional syntax for getting a range over a container's contents is the slicing operator []. T -- It said to install Windows 2000 or better, so I installed Linux instead.