You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was digging through how you handle non vector members for CSV and was curious about the reasoning behind the API requiring rowwise csv writes to be vector or array
struct struct_with_optional
{
std::optional<int> number{std::nullopt};
std::optional<std::string> string{""};
// other various types with detail specializations
};
Is there a way I can write my non vector members without the keys, or the end line appended?
std::string csv;
struct_with_optional s{}
s. number = 123
glz::write_csv(s, csv)
std::string csv2
s.number = std::nullopt
s.string = "456"
glz::write_csv(s, csv2)
csv output:
123,
csv2 output:
,"456"
Edit: I suppose this issue #1305 already covers this ask, but it's slightly different (vector of structs vs just one struct to a csv line). Mabe if there were an additional opt field like transpose_members to treat all the members as a single csv row?
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up. This would be helpful to add and you can feel free to submit a pull request. Otherwise, I'll keep this issue alive and try to address it sooner than later, but right now I'm limited on development time.
I was digging through how you handle non vector members for CSV and was curious about the reasoning behind the API requiring rowwise csv writes to be vector or array
csv/write.hpp
I have:
Is there a way I can write my non vector members without the keys, or the end line appended?
csv output:
csv2 output:
Edit: I suppose this issue #1305 already covers this ask, but it's slightly different (vector of structs vs just one struct to a csv line). Mabe if there were an additional opt field like
transpose_members
to treat all the members as a single csv row?The text was updated successfully, but these errors were encountered: