Re: reading from file

2016-12-30 Thread KaattuPoochi via Digitalmars-d-learn
On Friday, 16 December 2016 at 08:03:22 UTC, Ali Çehreli wrote: shared static this() { matrix = (cast(immutable(int[width])*)buffer.ptr)[0..height]; // Make sure we did not copy into matrix assert(cast(void*)matrix.ptr == cast(void*)buffer.ptr); } Thanks Ali, this is neat!!

Re: reading from file

2016-12-15 Thread KaattuPoochi via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:13:26 UTC, Ali wrote: And extending Ali's solution you can actually get the data in to a two dimentional array at compile time and have it in static memory with a small adjustment: static immutable matrix = import("data.txt") .split("\n") .map!(a =>