We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd40b7a commit f9137ebCopy full SHA for f9137eb
include/rfl/ubjson/Reader.hpp
@@ -59,10 +59,12 @@ class Reader {
59
return _var.val_->as<std::string>();
60
} else if constexpr (std::is_same<std::remove_cvref_t<T>,
61
rfl::Bytestring>()) {
62
- if (!_var.val_->is_byte_string()) {
+ if (!_var.val_->is<std::vector<uint8_t>>()) {
63
return Error("Could not cast to bytestring.");
64
}
65
- return rfl::Bytestring(); // TODO
+ const auto vec = _var.val_->as<std::vector<uint8_t>>();
66
+ return rfl::Bytestring(std::bit_cast<const std::byte*>(vec.data()),
67
+ vec.size());
68
} else if constexpr (std::is_same<std::remove_cvref_t<T>, bool>()) {
69
if (!_var.val_->is_bool()) {
70
return rfl::Error("Could not cast to boolean.");
0 commit comments