Skip to content

Commit

Permalink
IOFile: Add std::array functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed Sep 3, 2021
1 parent 156ccdb commit 1b912cb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Source/Core/Common/IOFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <array>
#include <cstddef>
#include <cstdio>
#include <string>
Expand Down Expand Up @@ -57,6 +58,18 @@ class IOFile
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(std::array<T, N>& elements)
{
return WriteArray(elements.data(), elements.size());
}

bool ReadBytes(void* data, size_t length)
{
return ReadArray(reinterpret_cast<char*>(data), length);
Expand Down

0 comments on commit 1b912cb

Please sign in to comment.