merge

Merge two types by their members.

If it has similar named members, then it uses the second one.

returns a named Tuple (or Aes) with all the members and their values.

template merge(T, U)
merge
(,)

Members

Functions

generateCode
auto generateCode()
Undocumented in source. Be warned that the author may not have intended to support it.
merge
auto merge(T base, U other)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import std.range : front;

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 = merge(aes, Aes!(NumericLabel!(string[]), "x",
    NumericLabel!(string[]), "y")(NumericLabel!(string[])(aes.x),
    NumericLabel!(string[])(aes.y)));

assertEqual(nlAes.x.front[0], 0);
assertEqual(nlAes.label.front, "e");
struct Point { double x; double y; string label = "Point"; }
auto pnt = Point( 1.0, 2.0 );

auto merged = DefaultValues.merge( pnt );
assertEqual( merged.x, 1.0 );
assertEqual( merged.y, 2.0 );
assertEqual( merged.colour, "black" );
assertEqual( merged.label, "Point" );

Meta