2022-02-19 13:04:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Runtime/Streams/CInputStream.hpp"
|
2022-02-25 07:45:25 +00:00
|
|
|
#include "Runtime/rstl.hpp"
|
2022-02-28 03:33:48 +00:00
|
|
|
#include <vector>
|
2022-02-19 13:04:45 +00:00
|
|
|
namespace metaforce {
|
|
|
|
template <class T, size_t N>
|
|
|
|
void read_reserved_vector(rstl::reserved_vector<T, N>& v, CInputStream& in) {
|
2022-03-07 23:53:42 +00:00
|
|
|
u32 count = in.ReadUint32();
|
2022-02-19 13:04:45 +00:00
|
|
|
v.resize(count);
|
|
|
|
for (u32 i = 0; i < count; ++i) {
|
|
|
|
v[i] = in.Get<T>();
|
|
|
|
}
|
|
|
|
}
|
2022-02-28 03:33:48 +00:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void read_vector(std::vector<T>& v, CInputStream& in) {
|
2022-03-07 23:53:42 +00:00
|
|
|
u32 count = in.ReadUint32();
|
2022-02-28 03:33:48 +00:00
|
|
|
v.reserve(count);
|
|
|
|
for (u32 i = 0; i < count; ++i) {
|
|
|
|
v.emplace_back(in.Get<T>());
|
|
|
|
}
|
|
|
|
}
|
2022-02-25 07:45:25 +00:00
|
|
|
} // namespace metaforce
|