예제 #1
0
void drop_while_example() {
    from({ 1, 2, 3, 4 }) | drop_while([](int i) { return i < 2; }) | dump();    // 2 3 4

    from({ 1, 2, 3, 4 }) | drop_while([](int i) { return i == 0; }) | dump();   // 1 2 3 4

    from({ 1, 2, 1, 1 }) | drop_while([](int i) { return i == 1; }) | dump();   // 2 1 1

    from({ 1, 2, 3, 4 }) | drop_while([](int i) { return i > 0; }) | dump();    // empty
}
Container trim_by(UnaryPredicate p, const Container& xs)
{
    internal::check_unary_predicate_for_container<UnaryPredicate, Container>();
    return trim_right_by(p, drop_while(p, xs));
}
Container trim_left(const T& x, const Container& xs)
{
    return drop_while(is_equal_to(x), xs);
}