sparrow 0.3.0
Loading...
Searching...
No Matches
list_value.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 implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <ostream>
18
22
23namespace sparrow
24{
26 {
27 public:
28
31 using size_type = std::size_t;
32
33 list_value() = default;
34 list_value(const array_wrapper* flat_array, size_type index_begin, size_type index_end);
35
36 size_type size() const;
37 bool empty() const;
38
40
43
44 private:
45
46 const array_wrapper* p_flat_array = nullptr;
47 size_type m_index_begin = 0u;
48 size_type m_index_end = 0u;
49 };
50
52 bool operator==(const list_value& lhs, const list_value& rhs);
53}
54
55#if defined(__cpp_lib_format)
56
57template <>
58struct std::formatter<sparrow::list_value>
59{
60 constexpr auto parse(std::format_parse_context& ctx) -> decltype(ctx.begin())
61 {
62 return ctx.begin(); // Simple implementation
63 }
64
65 SPARROW_API auto format(const sparrow::list_value& list_value, std::format_context& ctx) const
66 -> decltype(ctx.out());
67};
68
69namespace sparrow
70{
71 SPARROW_API std::ostream& operator<<(std::ostream& os, const sparrow::list_value& value);
72}
73
74#endif
Base class for array type erasure.
const_reference operator[](size_type i) const
const_reference back() const
array_traits::value_type value_type
bool empty() const
array_traits::const_reference const_reference
const_reference front() const
size_type size() const
std::size_t size_type
list_value(const array_wrapper *flat_array, size_type index_begin, size_type index_end)
#define SPARROW_API
Definition config.hpp:38
SPARROW_API bool operator==(const array &lhs, const array &rhs)
Compares the content of two arrays.
std::ostream & operator<<(std::ostream &stream, T n)
Definition large_int.hpp:93
mpl::rename< mpl::transform< detail::array_const_reference_t, all_base_types_t >, nullable_variant > const_reference
mpl::rename< mpl::transform< detail::array_value_type_t, all_base_types_t >, nullable_variant > value_type