Closed ftpronk closed 1 year ago
See #370, specifically this comment.
Addressed one issue before mine.. facepalm
Thank you for coming back to me, I'll take a look.
For posterity, to serialize a std::vector<> inline, use the experimental flag _WIP_STYLE_FLOW_SL
.
My example code becomes:
int main(int argc, char *argv[])
{
ryml::Tree tree1;
ryml::NodeRef root = tree.rootref();
root |= ryml::MAP; // mark root as a map
root["int_1"] << 42;
root["list_1"] << std::vector<int>{1, 2, 3};
root["list_1"] |= c4::yml::_WIP_STYLE_FLOW_SL;
std::string str_result = ryml::emitrs_yaml<std::string>(tree);
std::cout << str_result << std::endl;
return 0;
}
With the output:
int_1: 42
list_1: [1,2,3]
Hello,
How can a std::vector {1, 2, 3} be serialize correctly to [1, 2, 3]?
I've tried:
And the result is: