setIntersectionAA

Intersection of two or more associative arrays of type Ts.

setIntersectionAA
(
Ts...
)
()
if (
Ts.length >= 2 &&
allSatisfy!(isAssociativeArray, Ts)
&&
!is(CommonType!(staticMap!(typeOfAAKey, Ts)) == void)
&&
!is(CommonType!(staticMap!(typeOfAAValue, Ts)) == void)
)

Examples

alias T = int[string];
T x2   = [	   "1":1, "2":2,		"4":4];
T x3   = ["0":0, "1":1, "2":2, "3":3, "4":4];
T x4   = [	   "1":1, "2":2, "3":3, "4":4, "5":5];
T xh;
auto y = setIntersectionAA(x2, x3, x4);
assert(y._shortestInputIndex == 0);
xh[y.front.key] = y.front.value;
assert(!y.empty);

y.popFront();
xh[y.front.key] = y.front.value;
assert(!y.empty);

y.popFront();
xh[y.front.key] = y.front.value;
assert(!y.empty);

y.popFront();
assert(y.empty);

assert(xh == x2);

See Also

https://forum.dlang.org/post/puwffthbqaktlqnourrs@forum.dlang.org TODO: Use switch + static foreach at https://forum.dlang.org/post/tdajgh$262i$1@digitalmars.com

Meta