Applied the byte containers to all byte formats (#474)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-08-04 21:45:27 +02:00
committed by GitHub
parent 07cf980a00
commit 93e41778ca
9 changed files with 133 additions and 105 deletions
+3 -2
View File
@@ -8,6 +8,7 @@
#include "../Processors.hpp"
#include "../Result.hpp"
#include "../concepts.hpp"
#include "../internal/ptr_cast.hpp"
#include "Parser.hpp"
@@ -25,7 +26,7 @@ auto read(const InputVarType& _obj) {
/// Parses an object from flexbuf using reflection.
template <class T, class... Ps>
auto read(const char* _bytes, const size_t _size) {
auto read(const concepts::ByteLike auto* _bytes, const size_t _size) {
const InputVarType root =
flexbuffers::GetRoot(internal::ptr_cast<const uint8_t*>(_bytes), _size);
return read<T, Ps...>(root);
@@ -33,7 +34,7 @@ auto read(const char* _bytes, const size_t _size) {
/// Parses an object from flexbuf using reflection.
template <class T, class... Ps>
auto read(const std::vector<char>& _bytes) {
auto read(const concepts::ContiguousByteContainer auto& _bytes) {
return read<T, Ps...>(_bytes.data(), _bytes.size());
}