Re: Alias this with array can only be used once

2012-02-23 Thread Blake Anderton
Good points on why an explicit range distinction is desired; I probably should have looked harder at how std.container worked. I'm also probably spoiled/unlearning from C#'s IEnumerableT syntactic sugar (foreach over enumerator, LINQ) which handles most of these considerations for you. You

Alias this with array can only be used once

2012-02-22 Thread Blake Anderton
Why doesn't this work? I'm assuming I'm not fully understanding how alias this interacts with ranges (i.e. the range isn't being reset after count is finished with it), but I'm not sure how to fix this either: import std.algorithm; class ArrayContainer { int[] values; this(int[] v) {

Re: Alias this with array can only be used once

2012-02-22 Thread Blake Anderton
Thanks all for the quick replies. You're right- I am mixing the container with the range to ill effect. I'm just doing this for practice so I'm not tied to any one solution, but I was trying to make the container work as much like a built-in type as possible. With an array the above tests

Compile Time Printing

2012-01-30 Thread Blake Anderton
So from what I've found searching the newsgroup and my own experimentation, the best way to accomplish compile time printing is to do something like this: string ctMain() { //evaluate and return the final result string } enum result = ctMain(); pragma(msg, result); I'm not a fan of having