1#ifndef VIENNASHE_IO_VECTOR_HPP_
2#define VIENNASHE_IO_VECTOR_HPP_
39 template <
typename VectorType>
41 const std::string & filename)
43 std::ifstream file(filename.c_str());
53 vec.resize(size,
false);
55 for (std::size_t i = 0; i < size; ++i)
70 template <
typename VectorType>
72 const std::string & filename)
74 std::ofstream writer(filename.c_str());
79 writer << vec.size() << std::endl;
80 for (std::size_t i = 0; i < vec.size(); ++i)
82 writer << vec[i] << std::endl;
Exception which is thrown if a file cannot be opened.
Exception which is thrown if a End-of-File is encountered even though further data is expected.
All the exceptions used within the viennashe::io namespace.
void read_vector_from_file(VectorType &vec, const std::string &filename)
Reads a vector from a file.
void write_vector_to_file(VectorType &vec, const std::string &filename)
Writes a vector to a file.
The main ViennaSHE namespace. All functionality resides inside this namespace.