On Thu, 17 May 2012 16:28:56 +0200, Christian Köstlin <christian.koest...@gmail.com> wrote:

On 5/15/12 19:44 , H. S. Teoh wrote:
On Tue, May 15, 2012 at 07:29:38PM +0200, Christian Köstlin wrote:
for [1, 2, 3] and iota(2, 10)?
[...]

What are you trying to accomplish?


T

actually i just want to do some commandline parsing with default-values like this:
int main(string[] args) {
   auto h = [1, 2, 3];
   if (args.length > 1) {
     h = iota(1, args[1].to!(int));
   }
   do_something_with(h);
   return 0;
}

In that case, you should probably replace
  h = iota(1, args[1].to!(int));
with
  h = iota(1, args[1].to!(int)).array();
(assuming 2.059)
or
  h = array(iota(1, args[1].to!(int)));

Reply via email to