differenceBy

Same as difference except you can make it operatete on a publicly accessible member of ElementType!Range

differenceBy
(
string member
alias pred = null
Range
Rs...
)
(
Range range
,
)
if (
isRangeOverValidPredicate!(pred, Range)
)

Parameters

member

which member in ElementType!Range to find difference over

pred

unary transformation or binary comparator

range
Type: Range

the range to inspect

values
Type: Rs

ranges or single values to exclude

SeeAlso: difference

Examples

1 struct A {
2     int value;
3 }
4 // with normal difference
5 assert([A(1), A(2), A(3)].difference!((a, b) => a.value < b.value)([A(2), A(3)]).equal([A(1)]));
6 
7 // by using the By() version
8 assert([A(1), A(2), A(3)].differenceBy!"value"([A(2), A(3)]).equal([A(1)]));

Meta

Since

0.0.1