sparrow 2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
variable_size_binary_iterator.hpp
Go to the documentation of this file.
1// Copyright 2024 Man Group Operations Limited
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or mplied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
20
21namespace sparrow
22{
29 template <class Layout, iterator_types Iterator_types>
32 variable_size_binary_value_iterator<Layout, Iterator_types>,
33 mpl::constify_t<Layout, true>,
34 typename Iterator_types::value_type,
35 typename Iterator_types::reference,
36 typename Iterator_types::iterator_tag,
37 std::ptrdiff_t>
38 {
39 public:
40
45 typename Iterator_types::value_type,
46 typename Iterator_types::reference,
47 typename Iterator_types::iterator_tag,
48 std::ptrdiff_t>;
49 using reference = typename base_type::reference;
52 using size_type = std::size_t;
53 using value_type = typename Iterator_types::value_type;
54
55 constexpr variable_size_binary_value_iterator() noexcept = default;
57
58 private:
59
60 [[nodiscard]] constexpr reference dereference() const;
61
62 friend class iterator_access;
63 };
64
65 /******************************************************
66 * variable_size_binary_value_iterator implementation *
67 ******************************************************/
68
69 template <class Layout, iterator_types Iterator_types>
72 size_type index
73 )
74 : base_type(layout, static_cast<std::ptrdiff_t>(index))
75 {
76 }
77
78 template <class Layout, iterator_types Iterator_types>
79 constexpr auto variable_size_binary_value_iterator<Layout, Iterator_types>::dereference() const -> reference
80 {
81 if constexpr (std::same_as<reference, typename Layout::inner_const_reference>)
82 {
83 return this->p_object->value(static_cast<size_type>(this->m_index));
84 }
85 else
86 {
87 return reference(const_cast<Layout*>(this->p_object), static_cast<size_type>(this->m_index));
88 }
89 }
90}
variable_size_binary_value_iterator< Layout, Iterator_types > self_type
constexpr variable_size_binary_value_iterator() noexcept=default
pointer_index_iterator_base< self_type, mpl::constify_t< Layout, true >, typename Iterator_types::value_type, typename Iterator_types::reference, typename Iterator_types::iterator_tag, std::ptrdiff_t > base_type
Concept for iterator types.
Concept for layouts.
typename constify< T, is_const >::type constify_t
Convenience alias for constify.
Definition mp_utils.hpp:807
Extensions to the C++ standard library.