On 12/08/2013 03:51 AM, seany wrote:

> consider the follwoing:
>
> import tango.io.Stdout, tango.io.Path, tango.text.Util;
> import std.algorithm, std.string , std.stdio, std.array, std.conv,
> std.regex, std.typecons;
>
> //i know al imports are not necessary for this example, just ^c^v from
> my actual code
>
> alias string[] surSegments

There are the missing semicolon above and other problems with the code.

> void makeHashmap(T,R)(T[] plainArr, string hashes, out R[] hashMap)
> {
>      //first split the hashes
>      string [] hashesArr = std.algorithm.splitter(hashes, ',').array;
>
>      for(int i = 0; i < plainArr.length; i++)
>      {
>          R hashElement;
>          for(int j = 0; j < hashesArr.length; j++)
>          {
>              hashElement[hashesArr[j]] =  = plainArr[i][j];

I think you wanted to append:

            hashElement[hashesArr[j]] ~= plainArr[i][j];

What helped me see what was going on was a bunch of pragma(msg) lines:

            pragma(msg, typeof(hashElement));
            pragma(msg, typeof(hashesArr[j]));
            pragma(msg, typeof(hashElement[hashesArr[j]]));
            pragma(msg, typeof(plainArr[i][j]));

Ali

Reply via email to