You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwstd::runtime_error(std::string("not enough data for float. Need " + std::to_string(sizeof(float)) + ", currently have ") + std::to_string(data.size()));
433
+
if (size() < sizeof(float)) {
434
+
throwstd::runtime_error(std::string("not enough data for float. Need " + std::to_string(sizeof(float)) + ", currently have ") + std::to_string(size()));
throwstd::runtime_error(std::string("not enough data for vector size. Need 4, currently have ") + std::to_string(data.size()));
447
+
if (size() < 4) {
448
+
throwstd::runtime_error(std::string("not enough data for vector size. Need 4, currently have ") + std::to_string(size()));
441
449
}
442
450
auto size = Get<uint32_t>();
443
-
auto result = std::vector<T>(data.data(), data.data()+size);
444
-
data = data.subspan(size);
451
+
auto result = std::vector<T>(data.first, data.first+size);
452
+
subspanImpl(size);
445
453
return result;
446
454
}
447
455
448
456
template <>
449
457
std::string Get<std::string>()
450
458
{
451
-
auto result = std::string(reinterpret_cast<charconst*>(data.data()));
452
-
if (data.size() < (result.size() + 1)) {
453
-
throwstd::runtime_error(std::string("not enough data for string. Need " + std::to_string(result.size() + 1) + ", currently have ") + std::to_string(data.size()));
459
+
auto result = std::string(reinterpret_cast<charconst*>(data.first));
460
+
if (size() < (result.size() + 1)) {
461
+
throwstd::runtime_error(std::string("not enough data for string. Need " + std::to_string(result.size() + 1) + ", currently have ") + std::to_string(size()));
454
462
}
455
-
data = data.subspan(result.size()+1); // +1 for the null terminator
463
+
subspanImpl(result.size()+1); // +1 for the null terminator
0 commit comments