std.range.only with different range types

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 8 12:42:15 PST 2015


On Sunday, 8 November 2015 at 19:57:34 UTC, Freddy wrote:
> ---
> import std.algorithm;
> import std.range;
> import std.stdio;
>
> void main(){
> 	only(iota(0,4),[1,4,5]).writeln;
> }
> ---
> How can I call std.range.only with different range types?

`only` is for creating a range from a list of values. iota(0, 4) 
and [1, 4, 5] are already ranges. Maybe you want to use 
std.range.chain?

assert(iota(1, 3).chain([3, 4]).equal([1, 2, 3, 4]));


More information about the Digitalmars-d-learn mailing list