cpp-msgpack-light 0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
array_ref_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 <cstring>
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_array_ref.
32 */
33
34template <typename Allocator>
36mutable_array_ref<Allocator>::operator[](std::size_t index) noexcept {
37 return mutable_object_ref_type(data_->data[index], *allocator_);
38}
39
40template <typename Allocator>
42mutable_array_ref<Allocator>::operator[](std::size_t index) const noexcept {
43 return const_object_ref_type{data_->data[index]};
44}
45
46/*
47 * Definition of some members of const_array_ref.
48 */
49
51const_array_ref::operator[](std::size_t index) const noexcept {
52 return const_object_ref_type{data_->data[index]};
53}
54
55} // namespace msgpack_light
Definition of classes of references to arrays.
const_object_ref const_object_ref_type
Type to access constant objects.
Definition array_ref.h:48
const details::array_data * data_
Data.
Definition array_ref.h:117
const_object_ref_type operator[](std::size_t index) const noexcept
Get an object.
details::array_data * data_
Data.
Definition array_ref.h:247
mutable_object_ref_type operator[](std::size_t index) noexcept
Get an object.
details::allocator_wrapper< Allocator > * allocator_
Allocator.
Definition array_ref.h:250
const_object_ref const_object_ref_type
Type to access constant objects.
Definition array_ref.h:142
mutable_object_ref< Allocator > mutable_object_ref_type
Type to access non-constant objects.
Definition array_ref.h:139
Namespace of this project.
Definition binary.h:33
Definition of object_data struct.
Definition of classes of references to objects.