ddash.algorithm.concat

Create a new range concatenating input range/value with any additional ranges and/or values.

Members

Functions

concat
auto concat(Values values)

Concats everything together using best effort.

Examples

1 import std.range: iota;
2 
3 // Concat stuff
4 assert([1, 2, 3].concat(4, [5], [6, 7], 8).equal(1.iota(9)));
5 
6 // Concat single element
7 assert([1].concat(2).equal([1, 2]));
8 
9 // Implicitly convertible doubles with ints
10 assert([1.0].concat([2, 3]).equal([1.0, 2.0, 3.0]));
11 
12 // Concat nothing to single value
13 assert(1.concat().equal([1]));
14 
15 // Concat nothing to range
16 assert([1].concat().equal([1]));
17 
18 // Concat values to another value
19 assert(1.concat(2, 3).equal([1, 2, 3]));
20 
21 // Concat ranges or values to another value
22 assert(1.concat(2, [3, 4]).equal([1, 2, 3, 4]));
23 
24 // Concat strings
25 assert("yo".concat("dles").equal("yodles"));
26 
27 // Concat stuff to string
28 assert("abc".concat(1, 2, 3).equal("abc123"));

Meta