14template <
class InputIter,
class Tp,
class BinaryFunc>
15void split(InputIter first, InputIter last, Tp sep, BinaryFunc f)
21 InputIter found = std::find(first, last, sep);
31template <
class InputIter,
class SeparaterIter,
class BinaryFunc>
32void split(InputIter first, InputIter last, SeparaterIter s_first, SeparaterIter s_last, BinaryFunc f)
38 InputIter found = std::find_first_of(first, last, s_first, s_last);
49 class Iter =
decltype(std::begin(std::declval<Range>())),
50 class =
decltype(std::end(std::declval<Range>()))>
51constexpr auto enumerate(Range&& range)
55 typename std::iterator_traits<Iter>::difference_type i;
57 bool operator!=(iterator
const& other)
const {
return iter != other.iter; }
58 void operator++() { ++i; ++iter; }
59 auto operator*()
const {
return std::tie(i, *iter); }
65 auto begin() {
return iterator{0, std::begin(range)}; }
66 auto end() {
return iterator{0, std::end(range)}; }
69 return range_wrapper{std::forward<Range>(range)};