November 08, 2015 std.range.only with different range types | ||||
---|---|---|---|---|
| ||||
--- 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? |
November 08, 2015 Re: std.range.only with different range types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Freddy | 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]));
|
Copyright © 1999-2021 by the D Language Foundation