EightBit/M6502/HarteTest_6502/element_t.h
Adrian Conlon f8b5045f99 Use string_view from simdjson. Interesting speed up.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
2021-10-24 11:15:10 +01:00

22 lines
639 B
C++

#pragma once
#include <cstdint>
#include <string>
#include "simdjson/simdjson.h"
class element_t {
private:
simdjson::dom::element m_raw;
protected:
element_t(simdjson::dom::element input) noexcept;
[[nodiscard]] auto raw() const noexcept { return m_raw; }
[[nodiscard]] auto at(std::string key) const noexcept { return raw()[key]; }
[[nodiscard]] auto operator[](std::string key) const noexcept { return at(key); }
[[nodiscard]] auto array_at(std::string key) const noexcept { return at(key).get_array(); }
[[nodiscard]] auto integer_at(std::string key) const noexcept { return at(key).get_int64(); }
};