1 #ifndef MEDUSA_BITS_IO_CSV_HPP_
2 #define MEDUSA_BITS_IO_CSV_HPP_
18 template <
typename arr_t>
19 void CSV::write(
const std::string& filename,
const arr_t& array) {
20 std::ofstream f(filename);
21 assert_msg(f.good(),
"Error opening CSV file '%s': %s.", filename, strerror(errno));
22 f << std::setprecision(16);
23 for (
const auto& x : array) {
28 template <
typename arr_t>
29 void CSV::write2d(
const std::string& filename,
const arr_t& array,
char separator) {
30 std::ofstream f(filename);
31 assert_msg(f.good(),
"Error opening CSV file '%s': %s.", filename, strerror(errno));
32 f << std::setprecision(16);
33 for (
const auto& x : array) {
35 for (
const auto& y : x) {
36 if (!first) f << separator;
46 #endif // MEDUSA_BITS_IO_CSV_HPP_