Skip to content
Snippets Groups Projects
Commit 0694cd13 authored by Davide Mor's avatar Davide Mor
Browse files

Uncommented csv example

parent 17b4e8f1
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Simple example, showing the creation of csv printer for arrays, based on reflector. Simple example, showing the creation of csv printer for arrays, based on reflector.
*/ */
// #include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "../reflect.hpp" #include "../reflect.hpp"
...@@ -10,46 +10,46 @@ Simple example, showing the creation of csv printer for arrays, based on reflect ...@@ -10,46 +10,46 @@ Simple example, showing the creation of csv printer for arrays, based on reflect
// Csv printer // Csv printer
// ================================ // ================================
// namespace Csv { namespace csv {
// template<typename T> template<typename T>
// constexpr void header(std::ostream& output) { constexpr void header(std::ostream& output) {
// bool first = true; bool first = true;
// T::reflect().for_each_field_type([&](const char* name, auto _type) { T::reflect().for_each_field_type([&](const char* name, auto _type) {
// if(!first) { if(!first) {
// output << ","; output << ",";
// } }
//
// output << name; output << name;
// first = false; first = false;
// }); });
//
// output << std::endl; output << std::endl;
// } }
//
// template<typename T> template<typename T>
// constexpr void row(std::ostream& output, T& value) { constexpr void row(std::ostream& output, T& value) {
// bool first = true; bool first = true;
// T::reflect().for_each_field(value, [&](const char* name, auto &field) { T::reflect().for_each_field(value, [&](const char* name, auto &field) {
// if(!first) { if(!first) {
// output << ","; output << ",";
// } }
//
// output << field; output << field;
// first = false; first = false;
// }); });
//
// output << std::endl; output << std::endl;
// } }
//
// template<typename T> template<typename T>
// constexpr void print(std::ostream& output, std::vector<T>& rows) { constexpr void print(std::ostream& output, std::vector<T>& rows) {
// Csv::header<T>(output); csv::header<T>(output);
// for(auto& row : rows) { for(auto& row : rows) {
// Csv::row(output, row); csv::row(output, row);
// } }
// } }
// } }
//
// ================================ // ================================
// main // main
// ================================ // ================================
...@@ -86,7 +86,7 @@ int main() { ...@@ -86,7 +86,7 @@ int main() {
Bar { 20, 35.0f, 'b', false } Bar { 20, 35.0f, 'b', false }
}; };
// Csv::print(std::cout, rows); csv::print(std::cout, rows);
return 0; return 0;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment