IOFile: Add std::array functions

This commit is contained in:
Pokechu22 2021-09-03 13:39:05 -07:00
parent a0a91ec4b8
commit aacc1a5e49
1 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <array>
#include <cstddef> #include <cstddef>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
@ -57,6 +58,18 @@ public:
return m_good; return m_good;
} }
template <typename T, std::size_t N>
bool ReadArray(std::array<T, N>& elements, size_t* num_read = nullptr)
{
return ReadArray(elements.data(), elements.size(), num_read);
}
template <typename T, std::size_t N>
bool WriteArray(const std::array<T, N>& elements)
{
return WriteArray(elements.data(), elements.size());
}
bool ReadBytes(void* data, size_t length) bool ReadBytes(void* data, size_t length)
{ {
return ReadArray(reinterpret_cast<char*>(data), length); return ReadArray(reinterpret_cast<char*>(data), length);