29 template <
bool is_const>
31 run_encoded_array_iterator<is_const>,
32 array_traits::const_reference,
33 std::bidirectional_iterator_tag,
34 array_traits::const_reference>
38 using array_ptr_type = std::conditional_t<is_const, const run_end_encoded_array*, run_end_encoded_array*>;
52 array_ptr_type p_array =
nullptr;
54 std::uint64_t m_index = 0;
55 std::uint64_t m_run_end_index = 0;
56 std::uint64_t m_acc_length_up = 0;
57 std::uint64_t m_acc_length_down = 0;
62 template <
bool is_const>
64 array_ptr_type array_ptr,
66 std::uint64_t run_end_index
69 , p_encoded_values_array(array_ptr->p_encoded_values_array.get())
71 , m_run_end_index(run_end_index)
73 m_index < p_array->size() ? p_array->get_acc_length(m_run_end_index) : p_array->m_encoded_length
75 , m_acc_length_down(m_run_end_index == 0 ? 0 : p_array->get_acc_length(m_run_end_index - 1))
79 template <
bool is_const>
82 return m_index == rhs.m_index;
85 template <
bool is_const>
86 void run_encoded_array_iterator<is_const>::increment()
92 m_acc_length_up = p_array->get_acc_length(m_run_end_index);
93 m_acc_length_down = 0;
95 else if (m_index >= p_array->size())
97 m_run_end_index = p_array->m_encoded_length;
99 else if (m_index == m_acc_length_up)
102 m_acc_length_up = p_array->get_acc_length(m_run_end_index);
103 m_acc_length_down = p_array->get_acc_length(m_run_end_index - 1);
107 template <
bool is_const>
108 void run_encoded_array_iterator<is_const>::decrement()
112 m_run_end_index = p_array->m_encoded_length;
114 else if (m_index == p_array->size() || m_index == m_acc_length_down)
117 m_acc_length_up = p_array->get_acc_length(m_run_end_index);
118 m_acc_length_down = m_run_end_index == 0 ? 0 : p_array->get_acc_length(m_run_end_index - 1);
123 template <
bool is_const>
126 return array_element(*p_encoded_values_array,
static_cast<std::size_t
>(m_run_end_index));
Base class for array type erasure.
run_encoded_array_iterator(array_ptr_type array_ptr, std::uint64_t index, std::uint64_t run_end_index)
run_encoded_array_iterator()=default
friend class iterator_access
SPARROW_API array_traits::const_reference array_element(const array_wrapper &ar, std::size_t index)
mpl::rename< mpl::unique< mpl::transform< detail::array_const_reference_t, all_base_types_t > >, nullable_variant > const_reference