Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default internal storage of arrays in ParameterList, when parsing a YAML file #190

Open
bartgol opened this issue Feb 22, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@bartgol
Copy link
Contributor

bartgol commented Feb 22, 2022

Having different storage for values and sequences when it comes to bool is annoying, also from the code complexity point of view.

As of today, our YAML parser stores arrays of bool as std::vector<int>. PR #189 changes that into std::vector<char>, so that we can tell a true array of ints from an array that is used to store bools. This, however, does not solve the asymmetry between "list of supported value types" and "list of supported sequence types".

One solution could be to store arrays as std::deque<T>, which is technically not an array, but it is still indexable via operator[] (which is likely all that a user needs). This would make parsing/writing/storing an array of T implementable as a for loop wrapping the parsing/writing/storing of individual T values.

This would be a NON backward compatible solution, since all p.get<std::vector<T>>(pname) calls will have to be changed. We could hope to implement a deprecated specialization for get<std::vector<T>>, so that old code can still work while the deprecated interface is there. But that interface would require some dark magic hack to provide a (const) ref to a vector without actually storing one.

@bartgol bartgol added the enhancement New feature or request label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant