filteredInplace

  1. C filteredInplace(C r)
  2. C filteredInplace(C r)
    C
    filteredInplace
    (
    alias predicate
    C
    )
    (
    C r
    )
    if (
    isSet!C &&
    is(typeof(unaryFun!predicate(C.ElementType.init)))
    )

Return Value

Type: C

r eagerly in-place filtered on predicate.

Examples

inplace filtering on hashset

import std.algorithm.iteration : filter;
import nxt.sso_hashmap_or_hashset : SSOHashSet, byElement;
import nxt.digestx.fnv : FNV;

alias X = SSOHashSet!(uint, null, FNV!(64, true));
enum pred = "a != 11";
// alias pred = (_) => _ != 1;

// TODO activate
// auto x = X.withElements([11, 12].s).filteredInplace!pred.byElement;
// assert(x.front == 12);

// x.popFront();
// assert(x.empty);

Meta