cpp-msgpack-light 0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
array_iterator.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <cstddef>
23
28
29namespace msgpack_light {
30
43template <typename Allocator = standard_allocator>
45public:
47 using difference_type = std::ptrdiff_t;
48
51
54
59 : pointer_(nullptr), allocator_(nullptr) {}
60
68 details::allocator_wrapper<Allocator>* allocator) noexcept
69 : pointer_(pointer), allocator_(allocator) {}
70
77
83 mutable_array_iterator& operator++() noexcept {
84 ++pointer_;
85 return *this;
86 }
87
93 const mutable_array_iterator // NOLINT(readability-const-return-type)
94 operator++(int) noexcept {
95 mutable_array_iterator copy{*this};
96 ++(*this);
97 return copy;
98 }
99
100private:
103
106};
107
119public:
121 using difference_type = std::ptrdiff_t;
122
125
128
132 const_array_iterator() noexcept : pointer_(nullptr) {}
133
139 explicit const_array_iterator(const details::object_data* pointer) noexcept
140 : pointer_(pointer) {}
141
147 const_object_ref operator*() const noexcept;
148
154 const_array_iterator& operator++() noexcept {
155 ++pointer_;
156 return *this;
157 }
158
164 const const_array_iterator // NOLINT(readability-const-return-type)
165 operator++(int) noexcept {
166 const_array_iterator copy{*this};
167 ++(*this);
168 return copy;
169 }
170
171private:
174};
175
176} // namespace msgpack_light
Definition of allocator_wrapper class.
Class of iterators of arrays to access constant objects.
const_array_iterator(const details::object_data *pointer) noexcept
Constructor.
const details::object_data * pointer_
Pointer to the current data.
const const_array_iterator operator++(int) noexcept
Increment this iterator.
const_object_ref operator*() const noexcept
Dereference this iterator.
const_object_ref value_type
Type of values.
const_object_ref reference
Type of references.
const_array_iterator() noexcept
Constructor.
std::ptrdiff_t difference_type
Type of differences.
Class to access constant objects.
Definition object_ref.h:129
Class of iterators of arrays to access non-constant objects.
mutable_array_iterator(details::object_data *pointer, details::allocator_wrapper< Allocator > *allocator) noexcept
Constructor.
mutable_object_ref< Allocator > operator*() const noexcept
Dereference this iterator.
std::ptrdiff_t difference_type
Type of differences.
mutable_object_ref< Allocator > reference
Type of references.
mutable_array_iterator() noexcept
Constructor.
const mutable_array_iterator operator++(int) noexcept
Increment this iterator.
mutable_object_ref< Allocator > value_type
Type of values.
details::allocator_wrapper< Allocator > * allocator_
Class to access non-constant objects.
Definition object_ref.h:48
Namespace of this project.
Definition binary.h:33
Definition of object_data struct.
Declaration of classes of references to objects.
Definition of standard_allocator class.
Struct of data of objects in MessagePack.
Definition object_data.h:94