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.container.hybrid_hashmap : HybridHashSet, byElement;
import nxt.digest.fnv : FNV;

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

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

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

Meta