cpp-msgpack-light 0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
map_iterator_impl.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 <utility>
23
26#include "msgpack_light/details/object_ref.h" // IWYU pragma: keep
27
28namespace msgpack_light {
29
30/*
31 * Definition of some members of mutable_map_iterator.
32 */
33
34template <typename Allocator>
35inline std::pair<mutable_object_ref<Allocator>, mutable_object_ref<Allocator>>
40
50template <typename Allocator>
51[[nodiscard]] inline bool operator==(mutable_map_iterator<Allocator> lhs,
53 return &(*lhs).first.data() == &(*rhs).first.data();
54}
55
65template <typename Allocator>
66[[nodiscard]] inline bool operator!=(mutable_map_iterator<Allocator> lhs,
68 return !(lhs == rhs);
69}
70
71/*
72 * Definition of some members of const_map_iterator.
73 */
74
75inline std::pair<const_object_ref, const_object_ref>
77 return {const_object_ref{pointer_->key}, const_object_ref{pointer_->value}};
78}
79
88[[nodiscard]] inline bool operator==(
89 const_map_iterator lhs, const_map_iterator rhs) noexcept {
90 return &(*lhs).first.data() == &(*rhs).first.data();
91}
92
101[[nodiscard]] inline bool operator!=(
102 const_map_iterator lhs, const_map_iterator rhs) noexcept {
103 return !(lhs == rhs);
104}
105
106} // namespace msgpack_light
Class of iterators of maps to access constant objects.
std::pair< const_object_ref, const_object_ref > operator*() const noexcept
Dereference this iterator.
const details::key_value_pair_data * pointer_
Pointer to the current data.
Class to access constant objects.
Definition object_ref.h:129
Class of iterators of maps to access non-constant objects.
details::allocator_wrapper< Allocator > * allocator_
Allocator.
std::pair< mutable_object_ref< Allocator >, mutable_object_ref< Allocator > > operator*() const noexcept
Dereference this iterator.
details::key_value_pair_data * pointer_
Pointer to the current data.
Class to access non-constant objects.
Definition object_ref.h:48
Definition of classes of iterators of maps.
Namespace of this project.
Definition binary.h:33
bool operator==(binary_view lhs, binary_view rhs)
Compare two binary data.
Definition binary.h:384
bool operator!=(binary_view lhs, binary_view rhs)
Compare two binary data.
Definition binary.h:397
Definition of object_data struct.
Definition of classes of references to objects.