8#include <libassert/assert.hpp>
9#include <range/v3/algorithm/copy.hpp>
10#include <range/v3/algorithm/transform.hpp>
11#include <range/v3/iterator/traits.hpp>
12#include <range/v3/range/access.hpp>
13#include <range/v3/range/concepts.hpp>
14#include <range/v3/range/primitives.hpp>
15#include <range/v3/range/traits.hpp>
25template <std::
size_t Size, EndiannessKind Endianness>
38 using iterator = std::array<Byte, Size>::iterator;
49 const Byte&
at(
size_t idx)
const {
return data.at(idx); }
51 constexpr bool empty()
const {
return data.empty(); }
55 constexpr auto begin()
const {
return data.begin(); }
59 constexpr auto end() {
return data.end(); }
61 constexpr auto end()
const {
return data.end(); }
63 constexpr auto cend()
const {
return data.cend(); }
65 constexpr std::size_t
size()
const {
return data.size(); }
67 std::array<Byte, Size>
data;
70 template <ranges::range Range>
71 requires requires(ranges::range_value_t<Range> value) {
74 constexpr void from_range(Range&& range) {
77 ranges::transform(std::forward<Range>(range),
data.begin(), [](
Byte value) { return Byte{value}; });
82template <
typename T,
typename... U>
85template <std::
size_t N>
88static_assert(std::is_aggregate_v<NativeByteArray<0>>);
89static_assert(std::is_aggregate_v<NativeByteArray<1>>);
90static_assert(std::is_aggregate_v<NativeByteArray<10>>);
97template <std::
size_t Size>
105template <std::
size_t I, std::
size_t N>
117template <std::
size_t I, std::
size_t N>
120 return arr.
data.at(I);
124template <std::
size_t I, std::
size_t N>
126constexpr const ::asmgrader::Byte&
get(const ::asmgrader::NativeByteArray<N>& arr) {
127 return arr.data.at(I);
131template <std::
size_t I, std::
size_t N>
136 return arr.data.at(I);
140template <std::
size_t I, std::
size_t N>
142constexpr const ::asmgrader::Byte&&
get(const ::asmgrader::NativeByteArray<N>&& arr) {
143 return arr.data.at(I);
constexpr ::asmgrader::Byte & get(::asmgrader::NativeByteArray< N > &arr)
Specialization of get to play nice with algorithms that work on tuple-like types.
Definition byte_array.hpp:119
Definition byte_array.hpp:27
std::array< Byte, Size >::const_reverse_iterator const_reverse_iterator
Definition byte_array.hpp:41
std::size_t size_type
Definition byte_array.hpp:32
std::ptrdiff_t difference_type
Definition byte_array.hpp:33
std::array< Byte, Size >::const_iterator const_iterator
Definition byte_array.hpp:39
constexpr bool empty() const
Definition byte_array.hpp:51
constexpr auto cbegin() const
Definition byte_array.hpp:57
constexpr auto begin()
Definition byte_array.hpp:53
std::array< Byte, Size >::reverse_iterator reverse_iterator
Definition byte_array.hpp:40
const Byte & operator[](size_t idx) const
Definition byte_array.hpp:45
std::allocator< Byte > allocator_type
Definition byte_array.hpp:31
Byte & operator[](size_t idx)
Definition byte_array.hpp:43
std::array< Byte, Size >::iterator iterator
Definition byte_array.hpp:38
std::array< Byte, Size > data
Definition byte_array.hpp:67
constexpr auto end() const
Definition byte_array.hpp:61
constexpr std::size_t size() const
Definition byte_array.hpp:65
const Byte & at(size_t idx) const
Definition byte_array.hpp:49
constexpr Byte & at(size_t idx)
Definition byte_array.hpp:47
constexpr auto end()
Definition byte_array.hpp:59
constexpr auto cend() const
Definition byte_array.hpp:63
constexpr auto begin() const
Definition byte_array.hpp:55
More user-friendly interface wrapper for a byte-like integral.
Definition byte.hpp:18
Definition asm_buffer.hpp:20
constexpr std::size_t get_static_size_or(std::size_t default_value)
Definition static_size.hpp:29
Definition byte_array.hpp:94
#define N
Definition test_macros.hpp:147