1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 07:17:06 +01:00

IO: code cleaning and string binary IO fix

This commit is contained in:
2015-12-08 13:53:33 +00:00
parent ab45f029f4
commit d68a72e28b
6 changed files with 71 additions and 49 deletions

View File

@ -22,6 +22,7 @@ namespace Grid {
void writeDefault(const std::string &s, const U &x);
template <typename U>
void writeDefault(const std::string &s, const std::vector<U> &x);
void writeDefault(const std::string &s, const char *x);
private:
std::ofstream file_;
};
@ -48,6 +49,9 @@ namespace Grid {
file_.write((char *)&x, sizeof(U));
}
template <>
void BinaryWriter::writeDefault(const std::string &s, const std::string &x);
template <typename U>
void BinaryWriter::writeDefault(const std::string &s, const std::vector<U> &x)
{
@ -67,6 +71,9 @@ namespace Grid {
file_.read((char *)&output, sizeof(U));
}
template <>
void BinaryReader::readDefault(const std::string &s, std::string &output);
template <typename U>
void BinaryReader::readDefault(const std::string &s, std::vector<U> &output)
{