intersectedWith

intersectedWith
(
C1
C2
)
(
C1 x
,
auto ref C2 y
)
if (
isInstanceOf!(SSOHashMapOrSet, C1) &&
isInstanceOf!(SSOHashMapOrSet, C2)
)

Return Value

Type: auto

x eagerly intersected with y. TODO move to container_algorithm.d.

Examples

r-value and l-value intersection

alias K = uint;
alias X = SSOHashMapOrSet!(K, void, null, FNV!(64, true));

auto x = X.withElements([12, 13].s);
auto y = X.withElements([10, 12, 13, 15].s).intersectedWith(x);
assert(y.length == 2);
assert(y.contains(12));
assert(y.contains(13));

r-value and r-value intersection

alias K = uint;
alias X = SSOHashMapOrSet!(K, void, null, FNV!(64, true));

auto y = X.withElements([10, 12, 13, 15].s).intersectedWith(X.withElements([12, 13].s));
assert(y.length == 2);
assert(y.contains(12));
assert(y.contains(13));

Meta