5#ifndef V8_BASE_ITERATOR_H_
6#define V8_BASE_ITERATOR_H_
17template <
class Category,
class Type,
class Diff = std::ptrdiff_t,
18 class Pointer = Type*,
class Reference = Type&>
31template <
typename ForwardIterator>
36 using pointer =
typename std::iterator_traits<iterator>::pointer;
37 using reference =
typename std::iterator_traits<iterator>::reference;
38 using value_type =
typename std::iterator_traits<iterator>::value_type;
40 typename std::iterator_traits<iterator>::difference_type;
50 auto rbegin()
const {
return std::make_reverse_iterator(
end_); }
51 auto rend()
const {
return std::make_reverse_iterator(
begin_); }
64template <
typename ForwardIterator>
85 return ptr != other.ptr;
88 return ptr == other.ptr;
132 auto new_end = std::end(t);
148 auto new_begin = std::begin(t);
160template <
class... Iterators>
163 std::bidirectional_iterator_tag,
164 std::tuple<typename std::iterator_traits<Iterators>::reference...>> {
167 std::tuple<typename std::iterator_traits<Iterators>::reference...>;
172 std::apply([](
auto&... iterators) { (++iterators, ...); },
its_);
176 template <
class Other>
178 return not_equal_impl(other, std::index_sequence_for<Iterators...>{});
183 [](
auto&... this_iterators) {
return value_type{*this_iterators...}; },
188 template <
class Other,
size_t... indices>
190 std::index_sequence<indices...>)
const {
191 return (... || (std::get<indices>(
its_) != std::get<indices>(other.its_)));
207template <
class... Containers>
208auto zip(Containers&... containers) {
212 TupleIt(containers.end()...));
TupleIterator(Iterators... its)
std::tuple< typename std::iterator_traits< Iterators >::reference... > value_type
value_type operator*() const
bool not_equal_impl(const Other &other, std::index_sequence< indices... >) const
std::tuple< Iterators... > its_
bool operator!=(const Other &other) const
TupleIterator & operator++()
reference operator[](difference_type n)
difference_type size() const
typename std::iterator_traits< iterator >::pointer pointer
typename std::iterator_traits< iterator >::reference reference
iterator_range(ForwardIterator begin, ForwardIterator end)
const_iterator const begin_
const_iterator const end_
typename std::iterator_traits< iterator >::difference_type difference_type
const_iterator cend() const
ForwardIterator const_iterator
const_iterator cbegin() const
typename std::iterator_traits< iterator >::value_type value_type
auto zip(Containers &... containers)
auto make_iterator_range(ForwardIterator begin, ForwardIterator end)
auto IterateWithoutLast(T &t)
auto IterateWithoutFirst(T &t)
#define DCHECK_NE(v1, v2)
bool operator==(const DerefPtrIterator &other) const
DerefPtrIterator & operator++()
DerefPtrIterator & operator--()
DerefPtrIterator(T *const *ptr)
bool operator!=(const DerefPtrIterator &other) const
Category iterator_category