takeNone

Creates an empty range from the given range in O(1). If it can, it will return the same range type. If not, it will return takeExactly(range, 0).

  1. auto takeNone()
  2. auto takeNone(R range)
    takeNone
    (
    R
    )
    ()
    if (
    isInputRange!R
    )

Examples

import std.algorithm.iteration : filter;
assert(takeNone([42, 27, 19]).empty);
assert(takeNone("dlang.org").empty);
assert(takeNone(filter!"true"([42, 27, 19])).empty);

Meta