On Sunday, September 18, 2016 09:36:13 e-y-e via Digitalmars-d-learn wrote:
> Use std.range's 'only' function [1], it takes variadic arguments
> of the same type and constructs a range consisting of them.
>
> Example:
>
>      import std.meta : AliasSeq;
>      import std.range : only;
>      import std.algorithm.comparison : equal;
>
>      alias names = AliasSeq!("Alice", "Bob");
>
>      auto range = only(names, "Chuck");
>      assert(range.equal(["Alice", "Bob", "Chuck"]));

You can also just stick them in an array. e.g.

auto namesArr = [names];

But obviously, that allocates memory. So, whether using only or allocating
an array would make more sense depends on what you want to do with the
resulting range.

- Jonathan M Davis

Reply via email to