Re: improving std.array.array

2012-07-22 Thread monarch_dodra
On Sunday, 22 July 2012 at 13:04:18 UTC, David Nadlinger wrote: I hit some of the problems you described a little while ago. Jonathan and I came to the conclusion that the best solution is to default to the same element type as the passed range, while allowing any type which the element type is

Re: improving std.array.array

2012-07-22 Thread Philippe Sigaud
On Sun, Jul 22, 2012 at 1:46 PM, monarch_dodra wrote: > ...But I think it has one major drawback: You can't specify the type of the > array you want. For example, if you have a range of ints, and you'd want to > duplicate it into a range of doubles, well array doesn't allow that. > > The above e

Re: improving std.array.array

2012-07-22 Thread David Nadlinger
I hit some of the problems you described a little while ago. Jonathan and I came to the conclusion that the best solution is to default to the same element type as the passed range, while allowing any type which the element type is convertible to to be specified via an extra template parameter,

improving std.array.array

2012-07-22 Thread monarch_dodra
array is one of my favorite features in Phobos. It is such a trivially stupid function, yet so incredibly useful/powerful. Just call it on any range, and you get a new raw array of the corresponding deferred type. Awesome! ...But I think it has one major drawback: You can't specify the type o