Static Length Propagation of Ranges

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 20 06:05:05 PDT 2016


On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote:
> ElementType!R[n] arrayN(size_t n, R)(R r)
> {
>     assert(r.length == n);
>     typeof(return) dst;
>     import std.algorithm.mutation : copy;
>     r.copy(dst[]);
>     return dst;
> }

Is there a place for part of this logic in Phobos?

I'm thinking perhaps array{N,Exactly} should be added to 
std.array.

The idea came to me after learning about dependent types in Idris:

http://www.idris-lang.org/


More information about the Digitalmars-d-learn mailing list