mergeRange

Merge the elements of two ranges. If first is not a range then merge that with each element of the second range and vice versa.

mergeRange
(
R1
R2
)
(
R1 r1
,
R2 r2
)
if (
isInputRange!R1 ||
isInputRange!R2
)

Examples

import std.range : front;
import ggplotd.aes : Aes, DefaultValues;

auto xs = ["a", "b"];
auto ys = ["c", "d"];
auto labels = ["e", "f"];
auto aes = Aes!(string[], "x", string[], "y", string[], "label")(xs, ys, labels);
auto nlAes = mergeRange(DefaultValues, aes );
assertEqual(nlAes.front.x, "a");
assertEqual(nlAes.front.label, "e");
assertEqual(nlAes.front.colour, "black");
auto nlAes2 = aes.mergeRange(DefaultValues);
assertEqual(nlAes2.front.x, "a");
assertEqual(nlAes2.front.label, "");
assertEqual(nlAes2.front.colour, "black");

Meta