is there a common type?
Simen Kjaeraas
simen.kjaras at gmail.com
Thu May 17 14:58:33 PDT 2012
On Thu, 17 May 2012 16:28:56 +0200, Christian Köstlin
<christian.koestlin at 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)));
More information about the Digitalmars-d-learn
mailing list