| 840 | // take_while(is_even, [0,2,4,5,6,7,8]) == [0,2,4] |
| 841 | template <typename Container, typename UnaryPredicate> |
| 842 | Container take_while(UnaryPredicate pred, const Container& xs) |
| 843 | { |
| 844 | internal::check_unary_predicate_for_container<UnaryPredicate, Container>(); |
| 845 | auto itFirst = std::find_if( |
| 846 | std::begin(xs), std::end(xs), logical_not(pred)); |
| 847 | if (itFirst == std::end(xs)) |
| 848 | return xs; |
| 849 | return Container(std::begin(xs), itFirst); |
| 850 | } |
| 851 | |
| 852 | // API search type: take_last_while : ((a -> Bool), [a]) -> [a] |
| 853 | // fwd bind count: 1 |
no test coverage detected