2021-10-22 13:10:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include "simdjson/simdjson.h"
|
|
|
|
|
|
|
|
class array_t {
|
|
|
|
private:
|
|
|
|
const simdjson::dom::array m_raw;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
array_t(simdjson::dom::array input) noexcept;
|
|
|
|
|
2021-10-23 17:46:59 +01:00
|
|
|
[[nodiscard]] auto raw() const noexcept { return m_raw; }
|
2021-10-22 13:10:23 +01:00
|
|
|
|
|
|
|
[[nodiscard]] auto at(size_t idx) const noexcept { return raw().at(idx); }
|
|
|
|
[[nodiscard]] auto integer_at(size_t idx) const noexcept { return (int64_t)at(idx); }
|
|
|
|
[[nodiscard]] auto address_at(size_t idx) const noexcept { return (uint16_t)integer_at(idx); }
|
|
|
|
[[nodiscard]] auto byte_at(size_t idx) const noexcept { return (uint8_t)integer_at(idx); }
|
|
|
|
|
|
|
|
public:
|
|
|
|
[[nodiscard]] auto begin() const noexcept { return m_raw.begin(); }
|
|
|
|
[[nodiscard]] auto end() const noexcept { return m_raw.end(); }
|
|
|
|
[[nodiscard]] auto size() const noexcept { return m_raw.size(); }
|
2021-10-23 17:46:59 +01:00
|
|
|
[[nodiscard]] auto operator[](size_t idx) const noexcept { return at(idx); }
|
2021-10-22 13:10:23 +01:00
|
|
|
};
|