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
It would be nice to allow users to provide YAML files that can directly be parsed into some structs. E.g., it would be nice to parse
My Complex: 1.0 + 3i
My Int Pairs: [ P(1,2), P(0,1)]
directly into a std::complex and a std::vector<std::pair<int,int>> respectively. Even more interesting/useful would be to parse straight into enums, so that one can do
auto plist = parse_yaml_file("blah.yaml");
MyEnum value = plist.get<MyEnum>("The Enum");
...
without having to tediously do string->enum conversion every time.
To do this, we should put the is_type<T> and str2type<T> functions into a separate file. Then, somehow, allow the user to provide its own specializations (along with operator<< for writing, if writing/print is needed). One way could be to have a "database" of these functions, and let the user register its own functions at any point before calling the YAML parse/write routines.
The text was updated successfully, but these errors were encountered:
It would be nice to allow users to provide YAML files that can directly be parsed into some structs. E.g., it would be nice to parse
directly into a
std::complex
and astd::vector<std::pair<int,int>>
respectively. Even more interesting/useful would be to parse straight into enums, so that one can dowithout having to tediously do string->enum conversion every time.
To do this, we should put the
is_type<T>
andstr2type<T>
functions into a separate file. Then, somehow, allow the user to provide its own specializations (along withoperator<<
for writing, if writing/print is needed). One way could be to have a "database" of these functions, and let the user register its own functions at any point before calling the YAML parse/write routines.The text was updated successfully, but these errors were encountered: